Php switches the database and online RT. my goal is to change the database link in one place and use the new link when querying other pages .. Now I enter a query page tttt. php: use the default link to query 3 Data. Then, select another region from the drop-down list, when I select the drop-down box, I use ajax to switch the database link from the background. then I enter the query page ttt. php, the data is still the data of the previous database... In addition to switching php databases
RT, my goal is to change the database link in one place and use the new link when querying other pages ..
Now, I enter tttt. php on the query page and use the default link to query 3 data records.
Then, I select other regions from the drop-down list. when I select the drop-down list, I used ajax to switch the database link from the background.
At this time, I will go to the query page ttt. php. The data is still the data of the previous DB...
In addition to listing the databases in each region for switchover, is there any better method? (Because the region is dynamically increased)
Require_once dirname (_ FILE _). '/../common/DbSingleHelper. php ';
Require_once dirname (_ FILE _). '/../svr_yunwei_config.php ';
$ DbsingleHelper = DBSingleHelper: singleton ();
$ SQL = 'SELECT count (*) as ct from login_log ';
$ Res = $ dbsingleHelper-> doSql ($ SQL );
Echo "number of items found:". $ res [0] ['CT ']."
";
// $ DbsingleHelper-> changeDbLink ("xxxx", "xxx ");
// $ R = $ dbsingleHelper-> doSql ($ SQL );
// Echo "new count:". $ r [0] ['CT '];
Is correct, but the problem is that the switch action is triggered by the operator. on another page, after the switch is triggered on another page, the result of this query is still the data of the previous DB...
It means that after I switch the db in one place, I cannot change the rest of the page... Even if a single column is used
Please advise...
PHP database industry data
Share:
------ Solution --------------------
If two pages are scheduled through a url, the same connection cannot be used.
When the program ends, the database is closed.
However, you can pass the object field between two pages through serialization.