Jump to content

How can I empty my records


vividona

Recommended Posts

Hiiii,

 

still checking my funny script 

 

Now I have another problem

 

see here

 

CREATE TABLE `userregdata` (
  `uid` mediumint(5) unsigned NOT NULL auto_increment,
  `ufname` varchar(30) NOT NULL,
  `ufamname` varchar(30) NOT NULL,
  `username` varchar(30) NOT NULL,
  `upswd` varchar(15) NOT NULL,
  `uemail` varchar(40) NOT NULL,
  `unumlev` int(3) NOT NULL default '1',
  `uipadd` varchar(16) NOT NULL,
  `uregdate` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`uid`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

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

 

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_TBL, parent::ClnUserFname(), parent::ClnUserFamName(), parent::ClnUserName(), parent::ClnUserPswd(),
			parent::ClnUserEmAdd(), parent::CheckIpAdd(), parent::CurDate())or die(mysql_error());
			$Result = mysql_query($QUERY);
			}

Link to comment
https://forums.phpfreaks.com/topic/131307-how-can-i-empty-my-records/
Share on other sites

Don't drop your database

 

1.you can empty the database

2.reset the auto_increment counter as follow

 

ALTER TABLE tbl_name AUTO_INCREMENT=1

 

Hope it helps

 

hi Sir,

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.