table join 'the where statment is ambigous'
Posted: Mon May 02, 2005 3:56 pm
Hows it going guys,
I've got this problem with a table join. I'm trying to select all the information from three different tables using the same variable inserted by the user. The inputted value is the customer ID and its present in all three tables so it thought i will use it to pull all the information out.
all the customer IDs are the same values as well in the tables
Its a very simple select query but i think i've done soemthing wrong
the customer ID is being inserted by the user in the HTML form.
it will then be outputted like this
if anyone has any ideas why query is wrong please let me know
yours william
I've got this problem with a table join. I'm trying to select all the information from three different tables using the same variable inserted by the user. The inputted value is the customer ID and its present in all three tables so it thought i will use it to pull all the information out.
all the customer IDs are the same values as well in the tables
Its a very simple select query but i think i've done soemthing wrong
Code: Select all
$result = mysql_query("SELECT * FROM customer,jobs,wanker WHERE CustomerID='$CustomerID'")or die(mysql_error());it will then be outputted like this
Code: Select all
while ($row = mysql_fetch_array($result))
{
echo "<tr><td>CustomerInfo.</td></tr><tr><td>CustomerID</td><td>Surname</td><td>Firstname</td><td>Address1</td><td>Address2</td><td>Address3</td><td>Postcode</td><td>HomeNo</td><td>MobileNo</td><td>E-mail</td></tr>";
echo "<tr>";
echo "<td>" . $row['CustomerID'] . "</td>";
echo "<td>" . $row['Surname'] . "</td>";
echo "<td>" . $row['Firstname'] . "</td>";
echo "<td>" . $row['Address1'] . "</td>";
echo "<td>" . $row['Address2'] . "</td>";
echo "<td>" . $row['Address3'] . "</td>";
echo "<td>" . $row['Postcode'] . "</td>";
echo "<td>" . $row['HomeNo'] . "</td>";
echo "<td>" . $row['MobileNo'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr><td>Appliance Info</td><tr><td>JobNo</td><td>ModelNo</td><td>SerialNo</td><td>ProductNo</td><td>ExpiryDate</td><td>PurchaseDate</td></tr>";
echo "<tr>";
echo "<td>" . $row['JobNo'] . "</td>";
echo "<td>" . $row['ModelNo'] . "</td>";
echo "<td>" . $row['SerialNo'] . "</td>";
echo "<td>" . $row['ProductNo'] . "</td>";
echo "<td>" . $row['ExpiryDate'] . "</td>";
echo "<td>" . $row['PurchaseDate'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "<tr><td>Job Info</td></tr><tr><td>Fault</td><td>Instructions</td><td>Calldate</td><td>Calltime</td><td>Postcode</td><td>Engineer</td><td>EngineerNo.</td></tr>";
echo "<td>" . $row['Fault'] . "</td>";
echo "<td>" . $row['Instructions'] . "</td>";
echo "<td>" . $row['CallDate'] . "</td>";
echo "<td>" . $row['CallTime'] . "</td>";
echo "<td>" . $row['Postcode'] . "</td>";
echo "<td>" . $row['EngineerNo'] . "</td>";
echo "</tr>";
}
echo "</table>";yours william