About how to add data INSERTINTOroom (roomid, name, id1, id2) values (1,232, $ _ POST [id1], $ _ POST [id2]) in mysql $ _ POST [id1], $ _ POST [id2] is a value, not an ID. how can this problem be solved? ------ Solution -------------------- $ _ POST [id: add mysql data
Insert into room (roomid, name, id1, id2) values ('1', '000000', '$ _ POST [id1]', '$ _ POST [id2]')
$ _ POST [id1], $ _ POST [id2] is a value, not an ID. how can this problem be solved?
------ Solution --------------------
$ _ POST [id1], $ _ POST [id2] indicates that the value is not an id concept.
Is the value in SQL a variable name, not a value.
Insert into room (roomid, name, id1, id2) values ('1', '000000', '{$ _ POST [id1]}', '{$ _ POST [id2]}')
Or
"Insert into room (roomid, name, id1, id2) values ('1', '123 ','". $ _ POST [id1]. "','". $ _ POST [id2]. "')"
------ Solution --------------------
What does it mean ??
------ Solution --------------------
The IDs of the two tables cannot be inserted in an insert statement at the same time.
If the id is set to auto_increment, you do not need to insert the id, and duplicate values cannot be inserted.
If not set to auto-growth:
SQL = "insert into room (roomid, name, id1) values (". $ _ POST ['roomid']. ",'". $ _ POST ['name']. "',". $ _ POST ['id1']. ")";
You can query multiple tables.
------ Solution --------------------
$ _ POST [id1], $ _ POST [id2] is his value