Results 1 to 3 of 3

Thread: how can I empty my records

  1. #1
    Join Date
    Oct 2008
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how can I empty my records

    Hiiii,

    still checking my funny script

    Now I have another problem

    see here

    PHP Code:
    CREATE TABLE `userregdata` (
      `
    uidmediumint(5unsigned NOT NULL auto_increment,
      `
    ufnamevarchar(30NOT NULL,
      `
    ufamnamevarchar(30NOT NULL,
      `
    usernamevarchar(30NOT NULL,
      `
    upswdvarchar(15NOT NULL,
      `
    uemailvarchar(40NOT NULL,
      `
    unumlevint(3NOT NULL default '1',
      `
    uipaddvarchar(16NOT NULL,
      `
    uregdatetimestamp NOT NULL default CURRENT_TIMESTAMP,
      
    PRIMARY KEY  (`uid`),
      
    UNIQUE KEY `username` (`username`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=
    as row (uid) is an auto-increment, the administrator should have row uid = 1

    this is ok my script till now works fine

    but the thing which is not fine, if I drop the database and need to install my script again
    and when administrator register during installation process sometimes I found my script gave him uid number 3 , 4, 5 or 6 . . . etc instade of 1

    how can I direct my script to uid = 1
    how can I empty my record before the process of adminstrator registration

    PHP Code:
    if( ! parent::getmail() == 0){
                    
    $QUERY sprintf("INSERT INTO %s (`ufname`, `ufamname`,`username`, `upswd`,
                    `uemail`, `uipadd`, `uregdate`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', NOW())"
    ,
                    
    parent::BHL_DB_USER_TBLparent::ClnUserFname(), parent::ClnUserFamName(), parent::ClnUserName(), parent::ClnUserPswd(),
                    
    parent::ClnUserEmAdd(), parent::CheckIpAdd(), parent::CurDate())or die(mysql_error());
                    
    $Result mysql_query($QUERY);
                    } 

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I cheat. When I use auto increment I would occasionally delete a file and there would be a gap in the ID# sequence or I would delete all of the records and want to start over from ID of one and move up sequentially from there or where ever the deleted file occurred. I created the following a while back
    PHP Code:
         $ID2=0;
         
    $get_list1 "select ID from table";
         
    $get_list_res1 mysql_query($get_list1) or die(mysql_error());
    while (
    $recs1 mysql_fetch_array($get_list_res1)) {
                 
    $IDa $recs1['ID'];
                 if ((
    $IDa-$ID)>1) {$ID++;$ID2=4;break;} 
                 
    $ID=$IDa;
               } if (
    $ID2<=1$ID++;
    echo 
    $ID
    It scans the table and determines the appropriate ID# to use next by first looking for gaps in the ID# of the table and then displaying the next ID# if there are no gaps.

  3. #3
    Join Date
    Oct 2008
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hiiiii,

    sometimes refuse to give uid = 1 if I drop my databse of no

    I discover this now

    I installed it new server

    I found out uid = 6

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •