I'm table joining through the customerID in both sql tables and when user enters the customerID in the html form it should on;y display that information.
If any use the customer ID in the customer is the only primay key, its not a primary key in the jobs table becuase one already exists.
If anyone has any suggestions that would be great.
Cheers
William
Code: Select all
<html>
<head>
<link href="Call%20Center.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="195" height="49" border="1" class="H1">
<tr>
<td>Customer Enquiry </td>
</tr>
</table>
<table width="60%" height="20%" border="1" class="Search">
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" name="Search">
<tr>
<td width="173">Search Customer ID </td>
<td width="259"><input name="CustomerID" type="text"></td>
<td width="259"><input name="Search" type="submit" value="Search"></td>
</tr>
</form>
</table>
<?php
if (isset ($_POST['CustomerID']))
{
$CutomerID= $_POST['CustomerID'];
$connection= mysql_connect("", "", "");
mysql_select_db ("");
$result = mysql_query("SELECT * from customer,jobs WHERE customer.CustomerID=jobs.CustomerID")or die(mysql_error());
echo "<font face=verdana size=10pt>";
echo "<table border=1 cellspacing=0 class=enquiry><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>";
while ($row = mysql_fetch_array($result))
{
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 "</table>";
echo "<font face=verdana size=10pt>";
echo "<table border=1 cellspacing=0 class=enquiry1><tr><td>Appliance Info</td><tr><td>JobNo</td><td>ModelNo</td><td>Mancode</td><td>SerialNo</td><td>ProductNo</td><td>ExpiryDate</td><td>PurchaseDate</td>";
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 "</table>";
echo "<font face=verdana size=10pt>";
echo "<table border=1 cellspacing=0 class=enquiry2><tr><td>Job Info</td></tr><tr><td>JobID</td><td>Fault</td><td>Instructions</td><td>Parts1</td><td>Parts2</td><td>Parts3</td><td>Calldate</td><td>Calltime</td><td>Postcode</td><td>Engineer</td><td>EngineerNo.</td>";
echo "<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['Engineer'] . "</td>";
echo "<td>" . $row['EngineerNo'] . "</td>";
echo "</tr>";
echo "</table>";
}
}
mysql_close($connection);
?>
</body>
</html>feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]