Sql query to sort catalog items ids out

Results 1 to 3 of 3
  1. #1
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Sql query to sort catalog items ids out

    Well, ages ago on Ragzezone, someone release a sql code that basically makes all your catalog ids go from 0 etc instead of being all over the place

    Does anyone have that? My catalog auto increment is bigger than 93570723 and it starts at 142.
    Would be nice to have it consecutive.
    Last edited by Spheral; 13-04-13 at 11:53 PM.


  2. #2
    Sean told me to come back Late3 is offline
    MemberRank
    Jul 2007 Join Date
    United KingdomLocation
    1,205Posts

    Re: Sql query to sort catalog items ids out

    Quote Originally Posted by waldopulanco View Post
    PHP Code:
       $arr_query mysql_query("SELECT * FROM mytable");
       for(
    $i 1$i < ($arr_row mysql_fetch_array($arr_query)); $i++){
          
    mysql_query("UPDATE mytable SET ID = ".$i." WHERE ID = ".$arr_row['ID']."");
          } 
    Something like this?

  3. #3
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: Sql query to sort catalog items ids out

    Quote Originally Posted by Late3 View Post
    Something like this?
    Works fine.



Advertisement