I want to set two columns in MySql as auto increment (int)
S.NO Q_id
I want to set both auto increased.
How can I do this?
In same table you can't use two auto increments fields. You can create a integer field and add value +=1 in php
...
$row_last_id++;
INSERT INTO ... values(id, $row_last_id)
Updated Try this: It can be possible with use of MyISAM storage engine try Below Code
CREATE TABLE invoices
( S_NO
mediumint unsigned NOT NULL auto_increment, Q_id
mediumint unsigned NOT NULL, date
date NOT NULL, PRIMARY KEY (S_NO,Q_id) ) COMMENT='' ENGINE='MyISAM'