Hi friends,

I have a form to create a company details.. which will insert the details into a table.
For this table, I need to have a auto increment field as character..

when we have autoincreament as Integer... whenever the new company is created..the number will increase from 0, 1, 2, 3,..and so on..

I have added a hidden text field in the form and set the value as C1.
I need the values to get auto increament..so when ever the company is created..the value adds on as c1, c2, c3....and so on...
and these values has to be updated in the database also..
I am so lost in this...
I am working with php and mysql...
Your help is much appreciated...

Thanks.
Tryphy

You can not insert character in AUTO_INCREMENT. Use AUTO_INCREMENT column to save numeric values but concatenate c with AUTO_INCREMENT value while display the data.

Hi friends,

I have a form to create a company details.. which will insert the details into a table.
For this table, I need to have a auto increment field as character..

when we have autoincreament as Integer... whenever the new company is created..the number will increase from 0, 1, 2, 3,..and so on..

I have added a hidden text field in the form and set the value as C1.
I need the values to get auto increament..so when ever the company is created..the value adds on as c1, c2, c3....and so on...
and these values has to be updated in the database also..
I am so lost in this...
I am working with php and mysql...
Your help is much appreciated...

Thanks.
Tryphy

Set the field as Auto increment in the database itself while designing the database. That solves your problem, when you insert any data the field with auto increment will automatically insert its data by increment of 1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.