note 108858 deleted from language.functions by danbrown
| From: | danbrown@php.net | Date: | Thu, 31 May 2012 16:49:45 +0000 |
| Subject: | note 108858 deleted from language.functions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188347@lists.php.net to get a copy of this message | ||
Note Submitter: joe1 at hotmail dot com
----
sample connection to local db with queries and preset functions.
<?php
$custID = $_POST["custID"];
$shipped = $_POST["shipped"];
?>
<?php
$conn = mysql_connect("localhost", "twastudent", "prac3");
mysql_select_db("warehouse", $conn);
$sql = "select orderNumber, orderDate, shippingDate, shipped, customer.customerID, firstName,
lastName, suburb FROM customer, orders WHERE customer.customerID='$custID' AND
shipped='$shipped' ORDER BY orderDate desc";
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());
?>
<?php if (mysql_num_rows($rs)>0){ ?>
<table border="1" summary="Product Information">
<tr>
<th>Order Number</th>
<th>Order Date</th>
<th>Shipping Date</th>
<th>Customer ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Suburb</th>
</tr>
<?php
while ($row = mysql_fetch_array($rs)) { ?>
<?php while ($row = mysql_fetch_array($rs)) { ?>
<tr>
<td><a href="view.php?<?php echo
$row["orderNumber"]?>"><?php echo
$row["orderNumber"]?></a></td>
<td><?php echo $row["orderDate"]?></td>
<td><?php echo $row["shippingDate"]?></td>
<td><?php echo $row["customerID"]?></td>
<td><?php echo $row["firstName"]?></td>
<td><?php echo $row["lastName"]?></td>
<td><?php echo $row["suburb"]?></td>
</tr>
<?php }
mysql_close($conn); ?>
<?php } ?></table>
<?php }
else {?> <p>The customer identity does NOT exist!</p>
<?php } ?>