Hi,
I'm trying to access two databases and retrieve the same data from each but I only want one "No People are on" to be displayed if there is no one on in both databases.
If one user is online, in only one database, I would like only the users name listed and not the "No People are on" message from the database that has no one online.
This is the code I have but it's not working.
<?php
$handle_db1 = mysql_connect("localhost","db1","ascent") OR die(mysql_error());
$handle_db2 = mysql_connect("localhost","db2","ascent") OR die(mysql_error());
mysql_select_db("people",$handle_db1) OR die(mysql_error());
mysql_select_db("people",$handle_db2) OR die(mysql_error());
$query= mysql_query("SELECT name FROM people WHERE online ='yes' ORDER BY name"); $which = $handle_db1;
$query= mysql_query("SELECT name FROM people WHERE online ='yes' ORDER BY name"); $which = $handle_db2;
$count=mysql_num_rows($query); $which = $handle_db1;
if($count<1)
{
$msg1="No People are on";
}
echo"$msg1";
while($row=mysql_fetch_array($query)){
$name = $row['name'];
echo "$name is On";
}
$count=mysql_num_rows($query); $which = $handle_db2;
if($count<1)
{
$msg2="No Pople are on";
}
echo"$msg2";
while($row=mysql_fetch_array($query)){
$name = $row['name'];
echo "$name is "On;
}
?>
Any insight would be greatly appreciated.
Thank you.