Home  >  Article  >  Backend Development  >  Detailed explanation of PHP insert syntax_PHP tutorial

Detailed explanation of PHP insert syntax_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:51:20810browse



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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319145.htmlTechArticleThere was this sentence in the last program: $exec="insertintoinfo(ename,pcname)values('". $_POST["ename"]."','".$_POST["pcname"]."')"; Explain the meaning of this sentence. SQL syntax for inserting records...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn