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):

<title>Prac 3 Task 3</title>
$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">
<th>Customer ID</th>
<th>First Name</th>
<th>Last Name </th>
<th>Street Address</th>
while ($row = mysql_fetch_array($rs)) { ?>
<td><?php echo $row["customerID"]?></td>
<td><?php echo $row["firstName"]?></td>
<?php }
mysql_close($conn); ?>

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?:|

8 Years
Discussion Span
Last Post by Roses89

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.