473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

how to auto increment in php code?

18
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `claims` (
  2. `id` BIGINT NOT NULL AUTO_INCREMENT ,
  3. `datecreated` DATE NOT NULL ,
  4. `timecreated` TIME NOT NULL ,
  5. `ref_no` VARCHAR( 50 ) NOT NULL ,
  6. `emp_id` BIGINT NOT NULL ,
  7. `emp_no` VARCHAR( 10 ) NOT NULL ,
  8. `emp_name` VARCHAR( 255 ) NOT NULL ,
  9. `pp_name` VARCHAR( 100 ) NOT NULL ,
  10. `claim_amt` DOUBLE NOT NULL ,
  11. `link_month` VARCHAR( 2 ) NOT NULL ,
  12. `link_year` VARCHAR( 4 ) NOT NULL ,
  13. PRIMARY KEY ( `id` )
  14. );
may i know how make id in auto increment in php code?
Apr 21 '08 #1
3 4248
mwasif
802 Expert 512MB
CREATE TABLE `claims` (
`id` BIGINT NOT NULL AUTO_INCREMENT ,
`datecreated` DATE NOT NULL ,
`timecreated` TIME NOT NULL ,
`ref_no` VARCHAR( 50 ) NOT NULL ,
`emp_id` BIGINT NOT NULL ,
`emp_no` VARCHAR( 10 ) NOT NULL ,
`emp_name` VARCHAR( 255 ) NOT NULL ,
`pp_name` VARCHAR( 100 ) NOT NULL ,
`claim_amt` DOUBLE NOT NULL ,
`link_month` VARCHAR( 2 ) NOT NULL ,
`link_year` VARCHAR( 4 ) NOT NULL ,
PRIMARY KEY ( `id` )
);

may i know how make id in auto increment in php code?
You don't need to make auto increment the id in PHP. Only insert the data without mentioning id column in the query .e.g

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO claims (datecreated) values ('2008-04-21');
Apr 21 '08 #2
ronverdonk
4,258 Expert 4TB
Or, when you use all values in your insert, specify a zero (0) for the auto_increment column.

Ronald
Apr 21 '08 #3
SeeMe
18
i get it aldy. thank you
Apr 22 '08 #4

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

Similar topics

2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
6
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I...
5
by: Paulovič Michal | last post by:
hi all, I have problem with SERIAL field type (or sequence functionality). I have table with three columns - ID, IDS, NAME. I want auto-increment IDS grouped by ID. Example: 1, 1, Ferdo 1, 2,...
5
by: vul | last post by:
In VB6 there is Auto Increment check box in Project Properties, which allow you have a new version every time you compile the project. Is there any easy way to have this feature in VB 2005? Some...
2
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...
13
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when...
1
by: rhepsi | last post by:
hii all, i have created a database with a table with number of fields....in msaccess ive set primary key as SNo: and its datatype as auto number... How to set the auto increment ???? ...
0
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...
5
by: David Wright | last post by:
Hello Everyone I would be grateful if someone could help me with the automatic increment of a field on my subform called ‘Test_SrNo’. I am Using Microsoft Office 2000. The auto entry of the...
3
by: paulyXvpf | last post by:
Hello, all... Just finished a handy tutorial that has helped me understand how to auto increment and post to a web page... but its only a Web User Control passing values from VB.NET method...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.