napisalem taka funkcje prosta do poboru id za pomoca pdo, jednak funkcja fetchAll nie dziala jak kozystam wczesniej z fetchColumn. Musze od nowa tworzyc zapytanie, co jest troche bez sensu :/
Jaka jest na to rada ?
function getArtistId($artist)
{
$pdo = $this->connectToDB();
$artist_data = $pdo->prepare("SELECT artist_id from album_artists WHERE artist_name = :artist_name");
$artist_data->bindParam(":artist_name", $artist);
$artist_data->execute();
if($artist_data->fetchColumn() == 0)
{
return false;
}else{
//$artist_data = $pdo->prepare("SELECT artist_id from album_artists WHERE artist_name = :artist_name"); -- dziala tylko z tym
//$artist_data->bindParam(":artist_name" , $artist); -- dziala tylko z tym
//$artist_data->execute(); -- dziala tylko z tym
$artist_result = $artist_data->fetchAll();
foreach($artist_result as $row)
{
echo " artist id: ";
echo $row['artist_id'];
$artist_id = $row['artist_id'];
}
return $artist_id;
}
}
spoko, juz sobie poradzilem.

trzeba zrobic to tak :
function getArtistId($artist) { $pdo = $this->connectToDB(); $artist_data = $pdo->prepare("SELECT artist_id from album_artists WHERE artist_name = :artist_name"); $artist_data->bindParam(":artist_name", $artist); $artist_data->execute(); $artist_result = $artist_data->fetchAll(); { return false; }else{ foreach($artist_result as $row) { $artist_id = $row['artist_id']; } return $artist_id; } }
elo.