Are there any different functions for these two SQL statements?

Source: Internet
Author: User
What are the different functions of these two SQL statements? 2 @ mysql_query (& quot; UPDATEusersSETs_abc0WHEREuskuku & quot;); mysql_query (& quot; UPDATEusersSETs_abc0WHEREuskuku & quot;) in the PHP file is an additional @ number, is there any difference between these two SQL statements?
2 sentences in the PHP file

@ Mysql_query ("UPDATE users SET s_abc = 0 WHERE us = 'kuku '");

Mysql_query ("UPDATE users SET s_abc = 0 WHERE us = 'kuku '");


There is one more @ Number. Is there any difference between them? Puzzled

------ Solution --------------------
[Email protected]. If an error message is thrown during execution of mysql_query, it is blocked and not displayed.
------ Solution --------------------
@ Error message not displayed
Error blocker. If an error occurs in mysql_query, @ will block it and no error will be displayed.
I do not add a base class for error handling in development projects.
------ Solution --------------------
@ Error control operator, blocking error messages.
Generally, @ is not added to the code. it is best to write the SQL statement as follows:
PHP code
$ SQL = "select * from table where dqs = '{$ dqs}'"; $ res = mysql_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 --------------------
@ Shield error message
Suggestion: do not use it during testing. this helps check errors and discover problems,
If the project is put into use, we recommend that you add this so that the error message appears.
This will not affect your 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.