Vote count:
0
I am trying to connect to two different databases simultaneously, which I did using:
$connect1 = mysql_connect("localhost","root","");
mysql_select_db("database1", $connect1);
$res1 = mysql_query("query",$connect1);
$connect2 = mysql_connect("localhost","root","",true);
mysql_select_db("database2", $connect2);
$res2 = mysql_query("query",$connect2);
As it is recomended at http://ift.tt/11NxarU
This works fine when I UPDATE two table values in the two databases. However, when I try to INSERT into the same two tables of the same two databases I get an error. The command is not being executed. And I get the mySQL command for the second database on the next screen i.e.
0 -
INSERT into products_description (products_id, language_id, products_name, products_description, products_url, products_viewed) VALUES ('12796', '1', 'COOKIES GINGERBREAD CHRISTMAS', 'COOKIES GINGERBREAD CHRISTMAS', '', '0')
[TEP STOP]
The $connect1 and $connect2 are handled from an application_top php file which is included in php. So closing the first database and opening the second database is not an option therefore I need to have both database connections open.
I would much appreciate any help.
asked 1 min ago
Need help to insert data in two different tables of two different database in php
Aucun commentaire:
Enregistrer un commentaire