How to insert the value of auto_increment to another field in "one" insert sql ???
I have a database and the structure is like
database_test2
table_test1
-------------------
id Name Xid
-------------------
1 XYZ 1
2 OPQ 2
3 ABC 3
4 DEF 4
5 RTY 5
the column id is auto_increment ....
when I insert a data into table_test1
I want the Xid get value and the value is the same with id
I know a way to do this , but it cost a lot of resources...
the way is to insert the data and leave the Xid blank ..
then use mysql_insert_id ..
then Update the Xid using the value ...
Shame on me.. ^^"
Does there any one can help me to solve this??
I found a solution on
mysql-get-next-auto_increment-value-fromfor-table/
But I don't know the
WHERE TABLE_SCHEMA = $dbName AND TABLE_NAME = $tblName. means ...
can you help me to make a complete SQL sentence???