PHP performs SQL return value related issues

Source: Internet
Author: User
PHP Execute SQL return value problem
PHP executes the SQL return value problem,
Execute the query, the successful return is the ID, the query statement is correct, such as the ID of the query does not exist, but the query is empty return what? What does a query error return?
What is the modification, what is the successful return, the correct statement, but what is the modified null return? What do I return when I modify an error?
What is the increase in execution, what is the successful return, and what is added to the error?
What is the deletion, what is the successful return, the DELETE statement is correct, but what is the empty return? Delete error and return what?
------to solve the idea----------------------
You can check it out for yourself!
Var_dump (output query-out variable)
You can see it!
------to solve the idea----------------------
echo ' your SQL statement ';
------to solve the idea----------------------
You can add the following statements after the execution
Die ("Execution failed, error line number". __line__. " Cause of error ". Mysql_error ());


If you are unsure you can execute the mysql_query () query before executing the
echo  $sql; exit ()
This will return the SQL statement and exit. Then you can check the SQL statements when stitching errors, and then you can directly in the MySQL client, such as the command line, the execution of this statement ....


The general Execution Sleect query returns a result set, and the direct if ($res) can be
Additions and deletions can be changed by calling Mysql_affected_rows () if the return-1 indicates that the execution failed

------to solve the idea----------------------
The Boolean value NULL, False, 0, "", are all represented as false,

Mysql_query returns a resource identifier for the Select,show,explain or DESCRIBE statement and prints it as a string similar to the "Resource ID #3", so it is true.

This "Resource ID #3" is like a sign that connects the data you want to manipulate, and when you manipulate it with a function, for example: mysql_fetch_array ($insert), he takes the results from the database to the function to do the argument.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.