Wednesday, August 21, 2013

I want to reset the item order of one of my table after deleting an item in between

// I want to reset the item order of one of my table after deleting an item in between

i got this code from the web, but i have lost the link. i want to say thank you to the original writer, this code works perfect/

mysql_query("SET @ordering_inc = 1;"); 
mysql_query("SET @new_ordering = 0;"); 
mysql_query("UPDATE " . $tbname . "_dt SET seq = (@new_ordering := @new_ordering + @ordering_inc) where billno='$billno' and date='$bdate' and oid='$oid' ORDER BY seq ;"); 


No comments: