The print mysql statement has a return value in Navicat, but the code run returns empty

problem description

the db public function getRow method is called somewhere, and the return value is:
2018-09-14 17:11:50 ERR: Array
(

)
[a] => 
[b] => 

)
but print out that the running mysql statement has a value in Navicat!
this method is also called elsewhere, which is normal. Even if this section runs the same business to process other data, the return value is normal

.

the environmental background of the problems and what methods you have tried

check that the sql received by the getRow internal method is normal (external operation is also valuable),

related codes

/ / Please paste the code text below (do not replace the code with pictures)

    var_dump($sql);    // var_dump
        $res = $this->query($sql,"",$param);
            
            if ($res !== false)
            {
            $res = mysql_fetch_assoc($res);
            logger::write(print_r($res, 1));
            ....
            var_dump(901);
            var_dump($res);    // 2018-09-14 17:11:50 ERR: Array
                                //(
                                //    [a] => 
                                //    [b] => 
                               // )
            return $res;
            }

what result do you expect? What is the error message actually seen?

I would like to ask which direction to debug, rivers and lakes emergency, thank each boss for his message!

Php
Jun.24,2021

doesn't know much about your query method, but I feel that since the sql statement is normal when debugging, print out the res. Then $res decides that it is best not to use $res! = = false after all, the value after query is either there or empty.


1. Mysql_fetch_assoc () is the first piece of data to be crawled and screened for printing. Is it possible that it is affected by this?
2. Remove it first and see if it can be printed

.
$res = $this->query($sql,"",$param);
$res = mysql_fetch_assoc($res);
var_dump($res);    

3. If this can print out the data, try again

$res = $this->query($sql,"",$param);
if ($res !== false)
{
  $res = mysql_fetch_assoc($res);
  var_dump($res);    
}

can only be checked step by step. The above is the humble opinion of this rookie. I hope I can help you

.

there is no difference in the results of the same sentence of sql running in Navicat and code! The difference occurs because when the transaction is executed, the previous sql statement is affected, and then the later execution fails and rolls back, resulting in different running results.

Menu