Jump to content

[SOLVED] Auto_Increment problem


BoarderLine

Recommended Posts

Hi all,

 

I am having some probs with entering a UserID into my MYSQL DB.  The problem I am having is that the UserID is not Auto Incrementing.  I have had this working fine before although have now changed my Registration page slightly only to find that MYSQL now throws an error for duplicate entry for the UserID field. It worked ok for several entries after i made changes although I did notice the entries were not in order +1 increments but instead all over the show from single digit #'s to the next being the full (10).  Now the same entry seems to be trying to insert every time when the form is processed.  I can't figure out why and this has become very frustrating. Please Help! Thanks.

 

DB settings for UserID field:

 

Type: Int(10)

Attributes: Unsigned

Null: No

Extra: auto_increment

Primary: Yes

-----------------------------------------------------------------------------------------

 

$ins_users1->setTable("users");

$ins_users1->setPrimaryKey("UserID", "NUMERIC_TYPE");

Link to comment
https://forums.phpfreaks.com/topic/133607-solved-auto_increment-problem/
Share on other sites

Ok thanks, Sorry im a little new to this (obviously haha), sorry hopefully this explains better. 

 

$ins_users1 = new tNG_insert($conn_HandsOn);

$tNGs->addTransaction($ins_users1);

 

$ins_users1->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");

$ins_users1->registerTrigger("BEFORE", "Trigger_CheckEmail", 50);

$ins_users1->registerTrigger("BEFORE", "CheckCaptcha", 20);

$ins_users1->registerTrigger("AFTER", "Trigger_WelcomeEmail", 40);

$ins_users1->registerTrigger("END", "Trigger_Default_Redirect", 99, "Home.php");

 

$ins_users1->setTable("users");

$ins_users1->addColumn("Last_Name", "STRING_TYPE", "POST", "Name_Last", "");

$ins_users1->addColumn("First_Name", "STRING_TYPE", "POST", "Name_First");

$ins_users1->addColumn("Contact", "STRING_TYPE", "POST", "Email1");

$ins_users1->addColumn("Entry", "STRING_TYPE", "POST", "Password1");

$ins_users1->addColumn("City", "STRING_TYPE", "POST", "city1");

$ins_users1->addColumn("MobileNum", "STRING_TYPE", "POST", "MobNum", "");

$ins_users1->addColumn("Join_Date", "DATE_TYPE", "VALUE", "{NOW} ");

$ins_users1->setPrimaryKey("UserID", "NUMERIC_TYPE");

 

$tNGs->executeTransactions();

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.