1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| <?php
include("config.php");
mysql_connect($dbhost, $dbusername, $dbpasswd);
mysql_select_db($database_name) or die( "Unable to select database");
$data = mysql_query("SELECT product_name,product_type,ended_date FROM Products ")or die(mysql_error()); ?>
<table>
<tr>
<th>Product Name</th>
<th>Product Type</th>
<th>Product Deadline</th>
<th>Product Details</th>
</tr>
<?php while($info = mysql_fetch_array( $data )) { ?>
<tr>
<td><?php echo $info['product_name'] ?> </td>
<td><?php echo $info['product_type'] ?> </td>
<td><?php echo $info['ended_date'] ?> </td>
<td><?php echo '<a href=view_items.php?> View details</a>'?> </td>
</tr>
<?php } ?>
</table>
2) views_items.php:
<?php
//$product_name = $_POST['product_name'];
include("conf.php");
mysql_connect($dbhost, $dbusername, $dbpasswd);
mysql_select_db($database_name) or die( "Unable to select database");
$data = mysql_query("SELECT Products.product_name, Products.product_type, Products.product_description, Products.ended_date,upload.product_name,upload.content FROM Products, upload where Products.product_name=upload.product_name ")or die(mysql_error());?>
<table>
<tr>
<th>Product Name</th>
<th>Product Type</th>
<th>Product Description</th>
<th>Product Deadline</th>
<th>Product image</th>
</tr>
<?php while($info = mysql_fetch_assoc($data)) { ?>
<tr>
<td><?php echo $info['product_name'] ?> </td>
<td><?php echo $info['product_type'] ?> </td>
<td><?php echo $info['product_description'] ?> </td>
<td><?php echo $info['ended_date'] ?> </td>
<td><img src="<?php
header("Content-type:$type");
echo base64_decode($content);
?>"</td>
</tr>
<?php } ?>
</table> |
Partager