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

Recommended Answers

just tell me the strucre of the table

Jump to Post

All 2 Replies

just tell me the strucre of the table

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.