First, you need to distinguish between the types of SQL statements:
Classification of SQL statements
(1) Ddl:data Define Language, data definition language--defining the column structure of a table
CREATE, DROP, ALTER, TRUNCATE
(2) Dml:data Manipulate Language, data manipulation language--record line of action table
INSERT, DELETE, UPDATE
(3) Dql:data query Language, data query Language--does not affect table rows and columns
SELECT
(4) Dcl:data control Language, Data Control Language-controls user permissions
GRANT, REVOKE
PHP provides two sets of libraries, Operation MySQL database: Mysql_xxx () and Mysqli_xxx (), the latter is an improved version of the previous paragraph, so it is now used mysqli_xxx ().
PHP Common Functions
(1) @ at the front of the line to suppress the output of the error message
(2) Die () terminates the execution of the current page and can output an error message
(3) Strtotime () converts a shape, such as ' Yyyy-mm-dd ', to a date time representation of the integer value of seconds
(4) Mysqli_affected_rows ($conn) returns the number of rows affected by the DML statement that was just executed
(5) Mysqli_fetch_rows ($result) returns a row of records as an indexed array
(6) MYSQLI_FETCH_ASSOC ($result) returns a row of records as an associative array
(7) Require (' x.php '): Include the contents of the specified file in the current location-the server-side page contains
(8) Mysqli_fetch_all ($result, MYSQLI_ASSOC): A one-time crawl query to all the record lines php>=5.4
(9) header (): Modify the message header
(mysqli_insert_id) ($conn): Fetch last self-increment data
(one) mysqli_query ($conn, $sql): Execute $sql statement
($_request[): Gets the data requested from the client
....
For the time being I only use these, need more words, PHP manual walk up ~
PHP $result = Mysqli_query ($conn, $sql) The return value of:
1) No matter what the statement, as long as the execution fails (such as SQL syntax error), return false;
2) If DML execution succeeds, returns true;
3) If the DQL execution succeeds, the query result set is returned;
Finally, if you are unsure of the results of the data, print the message in AJAX or open the PHP file directly to view the results.
PHP operation MySQL Database related functions