Hi,
This is how my program works.When sales records are displayed in a list, the administrator would be able to click any record and view the details of the sales. In these details, there's one field where i asked the user to input the company that buys things from the user. That company name has to be highlighted and hyperlinked to its customer.php page that l displays the customer details. But how do i link them? Take a look at my codes.
list_salesdetails.php
.........................................................................................................
<?
$dbuser = "root";
$dbserver = "localhost";
$dbpass = "dck";
$dbname = "bng";
//***** BEGIN LISTING THE CONTENTS OF sales******
//CONNECTION STRING
mysql_connect($dbserver, $dbuser, $dbpass)
or die ("UNABLE TO CONNECT TO DATABASE");
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE");
$sql = "SELECT * FROM sales";
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
do
{
$Company=$myrow["Company"];
$DateOfPurchase=$myrow["DateOfPurchase"];
$Product=$myrow["Product"];
$Logo=$myrow["Logo"];
$Quantity=$myrow["Quantity"];
$UnitPrice=$myrow["UnitPrice"];
$ConfirmationOrderCopy=$myrow["ConfirmationOrderCopy"];
$TotalAmount=$myrow["TotalAmount"];
$ReceivedPayment=$myrow["ReceivedPayment"];
$AmountReceived=$myrow["AmountReceived"];
$Remarks=$myrow["Remarks"];
echo "<BR>Company: $Company";
echo "<BR>Date of purchase: $DateOfPurchase";
echo "<BR>Item sold: $Product";
echo "<BR>Logo used with item(if any): $Logo";
echo "<BR>Quantity: $Quantity";
echo "<BR>Unit price: $UnitPrice";
echo "<BR>No.of copies to order(after confirmation with customer): $ConfirmationOrderCopy";
echo "<BR>Total amount: $TotalAmount";
echo "<BR>Received payment: $ReceivedPayment";
echo "<BR>Amount received: $AmountReceived";
echo "<BR>Remarks: $Remarks";
echo "<BR>";
}
while ($myrow = mysql_fetch_array($result));
}
?>
list_customer.php
.....................................................................................................
<?
$dbuser = "root";
$dbserver = "localhost";
$dbpass = "dck";
$dbname = "bng";
//***** BEGIN LISTING THE CONTENTS OF customer******
//CONNECTION STRING
mysql_connect($dbserver, $dbuser, $dbpass)
or die ("UNABLE TO CONNECT TO DATABASE");
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE");
$sql = "SELECT * FROM customer";
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
do
{
$Company=$myrow["Company"];
$NatureOfBusiness=$myrow["NatureOfBusiness"];
$ContactPerson=$myrow["ContactPerson"];
$Position=$myrow["Position"];
$Address=$myrow["Address"];
$Telephone=$myrow["Telephone"];
$Fax=$myrow["Fax"];
$MobilePhone=$myrow["MobilePhone"];
$Email=$myrow["Email"];
$Website=$myrow["Website"];
$Birthday=$myrow["Birthday"];
$Remarks=$myrow["Remarks"];
echo "<BR>Company: $Company";
echo "<BR>Nature of business: $NatureOfBusiness";
echo "<BR>Contact person: $ContactPerson";
echo "<BR>Position: $Position";
echo "<BR>Address: $Address";
echo "<BR>Teleophone: $Telephone";
echo "<BR>Fax: $Fax";
echo "<BR>Mobile phone: $MobilePhone";
echo "<BR>E-mail: $Email";
echo "<BR>Website: $Website";
echo "<BR>Birthday: $Birthday";
echo "<BR>Remarks: $Remarks";
echo "<BR>";
}
while ($myrow = mysql_fetch_array($result));
}
?>
Thanks for a quick and efficient answer.