php_beginner_83 Posted September 20, 2009 Share Posted September 20, 2009 Hi All I'm not sure if this is a php problem or mysql but I'm having a problem trying to get info from my database. Currently, this is my code to get all the info I need.. $result = mysql_query("SELECT * FROM pictures INNER JOIN pics_in_albums ON pictures.ID = pics_in_albums.PicID INNER JOIN albums ON pics_in_albums.AlbumID = albums.ID WHERE albums.ID = \"$albumID\"") or die(mysql_error()); What I'm trying to do is display a picture then underneath have a description displayed. Both the image path and description of the photo are stored in the database. In my 'pictures' table, I have the fields 'ID', 'Description', 'Path'. In my 'albums' table i have, 'ID', 'Title', 'Description', 'Place'. However, when I use the following code, the 'Description' from the 'albums' table is displayed and not the one from 'pictures' table. while ($row = mysql_fetch_array($result)) { $descriptions[$counter] = $row['Description']; $paths[$counter] = substr(strrchr($row['Path'],92),1); $counter++; } I've been trying to fix it but not having any success, does anyone have any ideas?? Thank you. Link to comment https://forums.phpfreaks.com/topic/174917-getting-info-from-database/ Share on other sites More sharing options...
guyfromfl Posted September 20, 2009 Share Posted September 20, 2009 change the function in the while loop from mysql_fetch_array to mysql_fetch_assoc Link to comment https://forums.phpfreaks.com/topic/174917-getting-info-from-database/#findComment-921804 Share on other sites More sharing options...
php_beginner_83 Posted September 20, 2009 Author Share Posted September 20, 2009 Thanks for the suggestion....I tried it and am still having the same problem. Link to comment https://forums.phpfreaks.com/topic/174917-getting-info-from-database/#findComment-921822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.