Phpcms has always encountered bugs while using it. it cannot be completely blamed. phpcms mainly loads the class library and mysql has db setting options.
Phpcms has always encountered bugs while using it. it cannot be completely blamed. phpcms mainly loads the class library and mysql has db setting options.
pc_base::load_sys_class("get_model", "model", 0); $get_db = new get_model(); //var_dump($get_db); $r = $get_db->sql_query("select * from v9_news where catid in ($catid) and status=99 and timetask!=0 order by id desc LIMIT 20");
Execution error db to other databases
Phpcms does not strictly set the database when the program loads multiple mysql instances.
Some less rigorous code libraries are loaded with mysql for execution.
Mysql_select_db ("test_db ");
But not reset
Phpcms/libs/classes/db_factory.class.php
/*** Get database operation instance * @ param $ db_name database configuration name */public function get_database ($ db_name) {if (! Isset ($ this-> db_list [$ db_name]) |! Is_object ($ this-> db_list [$ db_name]) {$ this-> db_list [$ db_name] = $ this-> connect ($ db_name );} return $ this-> db_list [$ db_name];}
In this way, the link may be invalid and the database will be incorrectly executed.
We recommend a php code to view the information of the currently used database.
$query="select database() AS `db`, user() AS `user`"; $result=mysql_query($query); $row = mysql_fetch_assoc($result); echo 'database: '.$row['db'],''; echo 'user: '.$row['user'];