Posted: Sat Nov 05, 2005 6:27 pm
Nah, number for page won't work because I already set it up for view.php?pix=blah.jpg. I can't think of how to make it id=12 instead on my gallery page so I'd like to at least try and get numbers from using pix=blah.jpg
So how do I count something and break out when $row['name'] == $_GET['pix'].. wait... i could do this..
Of course it's a watered version of what I want it to do... but you get an idea... could that work? I don't know if break can be used in if/else statement though... any another function that does the same with "break"?
So how do I count something and break out when $row['name'] == $_GET['pix'].. wait... i could do this..
Code: Select all
$sql = "SELECT * FROM $table ORDER BY date DESC";
$result = mysql_query($sql);
// n is for number of current image... set one for now
$n = 1;
while ($row = mysql_fetch_assoc($result)) {
if ($row['name'] == $_GET['pix']) {
break;
} else {
$i++;
}
}
// then sql limit
$sql = "SELECT * FROM $table ORDER BY date DESC LIMIT $i, 1";
$sqlp = "SELECT * FROM $table ORDER BY date DESC LIMIT $i-1, 1";
$sqln = "SELECT * FROM $table ORDER BY date DESC LIMIT $i+1, 1";