-
Auto Incremet Query is not working
Hey dears, I have a problem with my auto increment feature of mysql. I have set my user_id field as a primary key and also auto increment . But it is not working. What are possible errors. Remeber one thing i am doing it with php. Please help me!
-
There could be a number of causes for this error if you are using PHP, but I would start at the SQL level to make sure you know what your increment value is set to. You can do this with the following command:
ALTER TABLE <TABLE NAME HERE> AUTO_INCREMENT = 1;
This will set the value to 1 and you can work from there on, so you know what to expect in your php variable. Are you using a MySQL function to retrieve the result set of you sql query and then assign the increment result to a php $variable?
Regards,
http://www.freemysql.org
-
Shahnawaz,
When you create table, you sould have something like this:
CREATE TABLE mytable (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|