Using PHPCMS to develop a small module of exam results query, with the PHPCMS version of the previous download on the computer for the framework development, all smooth. Want to download a new version, and later also avoid the trouble of upgrading. Then, the download is good, and then the module directory, model database connection files, templates and configuration files are copied.
However, the problem has arisen!
...... Debugging for a few hours, in the old and new version of the switch several times, and finally found that the PHPCMS version caused the problem, I le a go!
Using exit () to locate, continue the study, found the problem in the following lines of code:
$result = $this->db->query ($sql);
while ($row =mysql_fetch_row ($result)) {
echo $row [0]. ' <br/> ';
}
These lines of code are indifferent and ineffective ... So, again toss ..., with GetType ($result) detected $result as the object, what object? Don't know, messy ...
Thought of the Var_dump () function.
After entering Var_dump ($result), an object (Mysqli_result) appears. It is indeed a connection resource object, but not a MySQL connection, but a mysqli connection.
Search using the Text Search tool to find the database configuration file database.php inside is such "' type ' = ' mysqli ',";
This is the crux of the problem, change the mysqli to MySQL, everything is normal. But certainly can't change back, so Baidu Mysqli.
It turns out that MySQL (process mode) and Mysqli (object mode) use query queries, but the functions that read row data are different.
MySQL (process mode) with $row = Mysql_fetch_row ($result) Such a way (originally used)
and Mysqli (object mode) with $row = $result, Fetch_row ();
Change it, everything is fine!
About the differences between MySQL and mysqli in Phpcms