The MySQL operation is successful, but no return value is returned? Run SQLcodemysql & gt; update '000000' setfinish0wheresid94664; QueryOK, 1 rowaffected (0.07sec) Rowsmatched: 1 changed: 1 warnings: statement in 0php: PHP MySQL operation successful, 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.