0

Hey guys,
Im new to php and i have been given a question which i dont understand:

--Create a PHP page that will display the content of each of the fields of the customer table of the warehouse database. Save the file as task3.php.The following code will be helpful (you will need to refer to the database table description above to determine the names of the fields that are not included in the code below):

<html>
<head>
<title>Prac 3 Task 3</title>
</head>
<body>
<?php
$conn = mysql_connect("localhost", "student", "prac3");
mysql_select_db("warehouse", $conn)
or die ('Database not found ' . mysql_error() );
$sql = "SELECT * FROM customer";
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());
?>
<table border="1" summary="Customer Details">
<tr>
<th>Customer ID</th>
<th>First Name</th>
<th>Last Name </th>
<th>Street Address</th>
<th>Suburb</th>
<th>State</th>
<th>postcode</th>
</tr>
<?php
while ($row = mysql_fetch_array($rs)) { ?>
<tr>
<td><?php echo $row["customerID"]?></td>
<td><?php echo $row["firstName"]?></td>
</tr>
<?php }
mysql_close($conn); ?>
</table></body></html>

I dont understand what im supposed to do.I know how to use php in forms, but ive never used mysql and php. How do i create an external php to gather the information from the database?Can anyone tell me how the linking works?Doing it in one file is easy,but how do u link it with an external file?:|

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Roses89
0

The customer table basically has the following structure:
customerID | firstName| lastName |address | suburb |state |postcode
int |Char 30 | Char 30 | Char 150 |Char 25 | Char 3 |int

Edited by Roses89: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.