Jump to content

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();

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.