Ask these two SQL statements, what are the different functions?

Source: Internet
Author: User
What are the different functions of these two SQL statements?
2 sentences in PHP file

@mysql_query ("UPDATE users SET s_abc=0 WHERE us= ' Kuku '");

mysql_query ("UPDATE users SET s_abc=0 WHERE us= ' Kuku '");


Just one more @, can you tell me what's the difference? Puzzled

------Solution--------------------
With @, if the mysql_query execution exception throws an error message, it will be masked and not displayed.
------Solution--------------------
@ Do not display error messages
The error suppression character. Mysql_query if he has an error, he will block it, and it will not show any errors.
I do not add in the development project, there are generally error-handling base class.
------Solution--------------------
@ ERROR control, masking error message.
It is generally not in the code, and it is best to write it when executing sql:
PHP code
 $sql = "SELECT * from table where dqs= ' {$DQS} '"; $res = Mys     Ql_query ($sql); if (! $res) die ("sql:{$sql} 
Error:". Mysql_error ()); if (mysql_affected_rows () > 0) {$arr = array (); while ($rows = Mysql_fetch_array (MYSQL_ASSOC)) {Array_push ($arr, $rows); }}else{echo "Query failed
Error:". Mysql_error ();}
------Solution--------------------
@ is a masking error message
Recommendation: Do not use when testing, this is useful to check for errors and find problems,
If the project is put into use, it is recommended to add this, so that the error message appears The
does not affect the user's use!
  • 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.