![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 71 Pomógł: 0 Dołączył: 5.03.2011 Ostrzeżenie: (0%) ![]() ![]() |
Witam.
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 :
elo. |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 18:30 |