I would use only a single query:
$sql = "UPDATE gallery SET order = (order+1) WHERE id_categ = ".$id;
$res = mysql_query($sql);
...
Is it possible?
I would use only a single query:
$sql = "UPDATE gallery SET order = (order+1) WHERE id_categ = ".$id;
$res = mysql_query($sql);
...
Is it possible?
mysql_affected_rows()
should to the job.
Copied from the manual:
<?php
mysql_query("UPDATE mytable SET used=1 WHERE id < 10");
printf ("Updated records: %d\n", mysql_affected_rows());
// Prints: "Updated Records: 10"
Yes, just use
after your query.
$sql = "UPDATE gallery SET order = (order+1) WHERE id_categ = ".$id;
$res = mysql_query($sql);
$rowsAffected = mysql_affected_rows();
Edit: Damn, you guys are fast ;)