Hey guys! Im doing a gallery where users can post photos and display them on the web my problem is I dont know how to pick the next photo from the database from a certain user...here is my table structure: (is in the 1.gif Attached)... Lets say im in the first photo how would I be able to get the info for the next photo? I though it was easy but because the script is gonna have different users I can't just add 1 to the post_id. Is there anyway of selecting the current one and going down or up? I came up with this code
CODE
$q3 = "SELECT * FROM flogPost WHERE post_userid = '$userId' ORDER BY post_id DESC limit 0,1";
$r3 = mysql_query($q3) or die(mysql_error());
$nextFoto = mysql_fetch_array($r3);
//sacando la foto previa?
$q4 = "SELECT * FROM flogPost WHERE post_userid = '$userId' ORDER BY post_id ASC limit 0,1";
$r4 = mysql_query($q4) or die(mysql_error());
$prevFoto = mysql_fetch_array($r4);
The code doesnt work because the only thing I'm doing is selecting the very first picture of the user and the very last one... Please help me a bit thanks.
This post has been edited by Xmod: 7 Aug, 2007 - 08:07 AM