Jump to content

query question


corillo181

Recommended Posts

why is this query work fine
[code]
$sel=mysql_query("SELECT photo_id FROM tra_photo WHERE album_id='".$_GET['a']."' AND photo_id>'$foto_id'")or die(mysql_error());
$back=mysql_fetch_array($sel);

[/code]
but this one doesn't
[code]
$sel=mysql_query("SELECT photo_id FROM tra_photo WHERE album_id='".$_GET['a']."' AND photo_id<'$foto_id'")or die(mysql_error());
$next=mysql_fetch_array($sel);

[/code]
the next link sends me to the first id instead of the next id from wich ever is selected at the time..
Link to comment
https://forums.phpfreaks.com/topic/34972-query-question/
Share on other sites

Try: [code]$sel = mysql_query("SELECT photo_id FROM tra_photo WHERE album_id='".$_GET['a']."' AND photo_id=photo_id-1")or die(mysql_error());
$back = mysql_fetch_array($sel);

$sel = mysql_query("SELECT photo_id FROM tra_photo WHERE album_id='".$_GET['a']."' AND photo_id=photo_id+1")or die(mysql_error());
$next = mysql_fetch_array($sel);[/code] instead
Link to comment
https://forums.phpfreaks.com/topic/34972-query-question/#findComment-164968
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.