php - Reorder the sequence of records in mysql -


how rearrange multiple records after deleting multiple records.my code deletes 1 record , rearrange records when delete multiple records,it cant reshuffle.

this codes works great when delete 1 record not work multiple records,

$sql="delete $user id='$id'"; $result=mysql_query($sql,$connection) or die(mysql_error());  $reorder = "update $user set id=id-1 id > $id"; $catch = mysql_query($reorder,$connection); 

you may need query for rows require reorder, re-order them calling update statement 1 @ time, careful set id='xx-1' id='xx'


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -