I'm adding data from a MySQL database to an array, but the program doesn´t start the if´s
$nextPhotoID = array_map(function ($p) {
return $p['id'];
},$nextPhoto);
if ($_GET['id'] != $nextPhotoID[count($nextPhotoID) -1]){
$right = $nextPhotoID[array_search('id', $nextPhotoID) +1];
-- $right is undefined variable, latter in code, where i need to write it
}
if ($_GET['id'] != $nextPhotoID[0]){
$left = $nextPhotoID[array_search('id', $nextPhotoID) -1];
}
-- same with $left
Why is it undefined variable? I don´t understand it at all. My SQL is working.