Re: database hell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/07/12 12:38, Nick Edwards wrote:
On 7/12/12, Gibbs <linux@xxxxxxxxxxxxxxx> wrote:
On 12/07/12 12:29, Nick Edwards wrote:
Hi

We have a program that manages users, throughout all database calls

created as:
$connect = mysql_connect($db_host--other variables);
mysql_query("Delete from clients where id=$User");

All this works good, but, we need, in the delete function to delete
from another database

$connmy=mysql_connect("host","user","pass");
                      mysql_select_db("vsq",$connmy);
                      mysql_query("DELETE from userprefs where
clientr='$User'");
$mysql_close($connmy);
this fails, unless we use a mysql_close prior to it, and then
reconnect to original database after we run this delete, how can we
get around this without closing and reopening?
We have a  perl script doing similar for manual runs, and it works
well knowing that $connmy is not $connect, I'm sure there is a simple
way to tell php but  I'm darned if I can see it.

Thanks
Niki

You need to make a new link. So you would add TRUE to the end of the
second connection.

$connmy=mysql_connect("host","user","pass", TRUE);

http://php.net/manual/en/function.mysql-connect.php


Thanks, will give that a shot

I forgot to add your queries will need the new link too. So

mysql_query("DELETE from userprefs where clientr='$User'", $connmy);

Gibbs



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux