473,513 Members | 2,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to automatically increment value in mysql

3 New Member
hi,
i have created one table called user_details for this table there is one
column called uid,which should increment automatically,when ever i insert
values

for this i have create table by using auto_increment,table created seccussfully,
bt if i insert values into this table by excluding tat uid(which is increment automatically),it is showing error column count doesnt match value of row count.

anybody knows where i was error,
ur reply greatly appreciate.

thanks
khan
Dec 13 '07 #1
2 1786
code green
1,726 Recognized Expert Top Contributor
i insert values into this table by excluding tat uid
Not sure what you are doing here but you must define the field names along with the values
Dec 13 '07 #2
mwasif
802 Recognized Expert Contributor
You should provide the filed names in the query leaving uid. e.g.
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO table_name (firstname, lastname) VALUES ('M', 'Wasif')
Or without field names
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO table_name VALUES ('', 'M', 'Wasif')
OR
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO table_name VALUES (NULL, 'M', 'Wasif')
The first method is preferable.
Dec 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1046
by: Gena | last post by:
Hi, Can anyone help me to increment the primary key's value on duplication without using mysql v 4.1 "on duplicate key" function? I can't upgrade to use the "on duplicate key" feature so am now...
0
2616
by: braedsjaa | last post by:
Just starting out with mySql / php ... hope this is a simple question and my description is understandable: I want to present table data from one row in one webpage with links to the previous...
11
4830
by: Randell D. | last post by:
Folks, I have a table of addresses and a seperate table with contact names - All addresses tie to one or more names - I would like to keep track of the number of names 'belonging' to an address...
2
4671
by: Kajol | last post by:
Hi All, I am using server version: 4.1.11-nt on windows 2000. I want to create a table with ID as auto increment and initialise it with a starting value of 1000. I am trying to do following...
7
3336
by: Bobby | last post by:
Please write suggestions on how to automatically increment time in a field (table or query). Example: Name | Time John Doe | 11:00 AM Jane Doe | 11:08 AM (8 minutes later) Jim Doe | 11:16...
2
118254
by: Brian Bendtsen | last post by:
Hi Is there at way to reset a table and set the auto increment value to 1000? /Brian Bendtsen
2
5507
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
0
4434
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
1
1072
by: rajesh0303 | last post by:
Hi. Problem is that all sessions are removed when I am using this code... By this code I am deleting files in a particular folder and then that folder.. Need help...... code is: try
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7111
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.