Loopity Loop Help
Posted: Fri Nov 21, 2008 8:04 pm
Creating an app that allows the user to upload 6 photos, it saves into the SQL database with an order.
If someone deletes Photo2, I need it to move Photo3 to Photo2, Photo4 to Photo3, Photo5 to Photo4, Photo6 to Photo5 -- leaving Photo 6 blank.
I know that I would need to do this with a loop, just a little stumped how.
If someone deletes Photo2, I need it to move Photo3 to Photo2, Photo4 to Photo3, Photo5 to Photo4, Photo6 to Photo5 -- leaving Photo 6 blank.
I know that I would need to do this with a loop, just a little stumped how.
Code: Select all
//if they deleted last photo, don't bother
if($order < 6)
{
$query = "select * from propertyimages where property = '$property'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
// See if any files apply
$query = "select * from propertyimages where property = '$property' and `order` > $order";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if($count > 0)
{
//Change the Files, -1 from order for anything that applies, Make a Loop
$i = $count;
???
}
}