Home > Article > Backend Development > Detailed explanation of PHP insert syntax_PHP tutorial
There was this sentence in the last program:
$exec="insert into info (ename,pcname) values ('".$_POST["ename"]."',' ".$_POST["pcname"]."')";
Explain the meaning of this sentence. The syntax for inserting records in SQL is:
insert into table name (field name 1, field name 2, ...) values ("value of field 1", "value of field 2", ...)
The previous program is based on this syntax. It should be noted that I have added quotation marks to the values in the values brackets. This is because the corresponding field type is varchar. If the corresponding field type If it is int or something like that, then the quotation marks should be removed! Be sure to pay attention.