MySQL operation is successful, but no return value

Source: Internet
Author: User
The MySQL operation is successful, but no return value is returned? Execute SQLcodemysql & gt; update '000000' setfinish0wheresid94664; QueryOK, 1 rowaffected (0.07sec) Rowsmatched: 1 changed: 1 warnings: MySQL in 0php successfully executed, but no return value?
Run the following command on the MySQL console:
SQL code
  mysql>update `1001` set finish=0 where sid=94664;Query OK,1 row affected (0.07 sec)Rows matched:1 changed:1 warnings:0


Php statements:

PHP code
  $tid=""`.$_COOKIE['uid'].""`;$which="finish=1";$where="sid=".$sid;$db=new Mysql("localhost","root","","members_check","","UTF8");$db->connect();$result=$db->update($tid,$which,$where);echo $result;    //if($result){echo 0;}else{echo 1;}


Nothing is returned from js. The following if statement cannot return 0. However, all operations in the database are successful.

Enclosed functions:

PHP code
  Public function query ($ SQL) {if ($ SQL = "") {echo "SQL statement is empty" ;}$ this-> SQL = $ SQL; $ result = mysql_query ($ this-> SQL, $ this-> conn) or die ('failed '. mysql_error (); $ this-> result = $ result; return $ this-> result;} public function update ($ table, $ mod_content, $ condition, $ url = '') {$ result = $ this-> query (" UPDATE $ table SET $ mod_content WHERE $ condition "); return $ result ;}


------ Solution --------------------
$ Result = $ db-> update ($ tid, $ which, $ where );
Var_dump ($ result );
Show null

Obviously, the code used by LZ is different from the code posted by LZ.
It is meaningless to continue the discussion.

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.