I currently have a linked table from two tables in one database. I would like to add information from a third table contained in another database. The code for the current table is:
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$result = mysql_query("SELECT A.Company, A.CStatus, A.OnlineLvl, B.CustomerID, B.Name, C.OrderID, C.DateCall, C.WStatus
FROM A, B, C WHERE A.CompanyID=C.CompanyID and B.CustomerID=C.CustomerID ") or die(mysql_error());
echo "<table border='1'>
<tr>
<th>Company</th>
<th>Company Status</th>
<th>Online Level</th>
<th>Customer ID</th>
<th>Customer Name</th>
<th>Order ID</th>
<th>Date of Call</th>
<th>Order Status</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Company'] . "</td>";
echo "<td>" . $row['CStatus'] . "</td>";
echo "<td>" . $row['OnlineLvl'] . "</td>";
echo "<td>" . $row['CustomerID'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['OrderID'] . "</td>";
echo "<td>" . $row['DateCall'] . "</td>";
echo "<td>" . $row['WStatus'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close(
I would like to add information from another table called 'phonecall' contained in database 'iphone'. I understand that you can call up information by putting the "database.table.row" in the select, from, and where for all the bits of information. However, how should I connect to the databases at this section of code:
mysql_select_db("", $con);
Do I put both database names here?
Thanks for any help!