Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
You all are probably getting tired of me posting meaningless stuff but I have yet again one more dumb issue..I am getting an undefined index error when I shouldn’t be. The error says this:
“Notice: Undefined index: album_id in C:\Program Files (x86)\EasyPHP-5.3.9\www\Image Upload\func\image.func.php on line 24”
Here is the where the issue is in the file:
function get_images($album_id){
$album_id = (int)$album_id;
$images = array();
$image_query = mysql_query("SELECT `image_id`, `album_id` `timestamp`, `ext` FROM `images` WHERE `album_id`=$album_id AND `user_id`=".$_SESSION['user_id']);
while($images_row = mysql_fetch_assoc($image_query)){
$images[] = array(
'id' => $images_row['image_id'],
'album' => $images_row['album_id'], //<<<<Here is error
'timestamp' => $images_row['timestamp'],
'ext' => $images_row['ext']
);
}
return $images;
}
Thanks again for all of your patience!
-TechGuy24
There is a syntax error in your query
=============================== ^
a
commais missing betweenalbum_idandtimestampChange your query to
and it will work like a charm 🙂
ALWAYS ALWAYS ALWAYS, first run queries on your database, before firing them with php. This will help you find errors faster. Of course you can see what error was there using php too, but why waste time?
Use phpMyAdmin to run queries. 🙂
PS : He who asks appears fool for 5 mins, he who doesn’t ask remains fool forever.
You have a question(however dumb it may be)? POST IT.