Ok, I did a search here in the forums for this and found the solution, or so I thought:
My main config.inc file includes the following at the top of all pages, to setup the main database connection:
$connection1 = mysql_connect($dbservername, $dbusername, $dbpassword) or die(mysql_error());;
if (!mysql_select_db($dbname, $connection1))
{
mysql_close ($connection1);
print".mysql_error()";
die ("stopped at mysql_select_db<p>");
}
Now, I want to import a usertable from another program into my database so that's gonna require two SQL sessions at one time. So I followed the directions that someone else said and renamed my original $link to $connection1 and added this bit of code to my migrate-clients.php file:
$connection2 = mysql_connect($mb_db_host, $mb_db_user, $mb_db_password) or die(mysql_error());
if (!mysql_select_db($mb_db_name, $connection2))
{
mysql_close ($connection2);
print".mysql_error()";
die ("stopped at mysql_select_db<p>");
}
Now, based on what I've read here in the forums, there should now be 2 connections opened...1 and 2.
The first thing I want to do is make sure that the imported user's login isn't going to conflict with an existing one so I have this code to begin the import process:
$query = "SELECT *
FROM client_info";
$result = mysql_query($query, $connection2) or die(mysql_error());
while ($items = mysql_fetch_array($result))
{
and this code to check for duplicate names:
// ** CHECK IF CLIENT EXISTS IN DATABASE
$infoquery = "SELECT *
FROM client_info
WHERE client_login = '$login'";
$inforesult = mysql_query($infoquery, $connection1) or die(mysql_error());
if (mysql_num_rows($inforesult) > 0)
{
$error_list .= "<BR> $name";
}
else
{
However when I run the script, I get:
Unknown column 'client_login' in 'where clause'
which leads me to believe that there is something wrong. The copy from uses client_username and mine is client_login.
So in a nutshell, it looks like I've done everything correctly, why isn't connection1 working?