Hi guys Good day, this codes works perfectly for me.
<?php
// This block grabs the whole list for viewing
$product_list = "";
$sql = mysql_query("SELECT * FROM product
ORDER BY date_added DESC");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["name"];
$details = $row["details"];
$size = $row["size"];
$price = $row["price"];
$quantity = $row["quantity"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$product_list .= "Product ID: $id
- <strong>$product_name</strong> -
Php$price -
<em>Added $date_added</em>
<a href='inventory_edit.php?pid=$id'>edit</a> •
<a href='inventory_list.php?deleteid=$id'>delete</a><br />";
}
} else {
$product_list = "You have no products listed in your store yet";
}
?>
My problem is i want to refactor this part and put it into table in order to give a pleasant look:
$product_list .= "Product ID: $id
- <strong>$product_name</strong> -
Php$price -
<em>Added $date_added</em>
<a href='inventory_edit.php?pid=$id'>edit</a> •
<a href='inventory_list.php?deleteid=$id'>delete</a><br />";
My Screenshots for my desired output.
http://img7.uploadhouse.com/fileuploads/17419/1741996659880843c6a2ae94919531384505f7a1.jpg
Here is what i did to refactor but it did not give me a good result:
$product_list .= "?>
<html>
<table >
<tr>
<td>
Product ID: <?php echo $id ?>
</td>
<td>
<?php echo $product_name; ?>
</td>
<td>
Php <?php echo $price; ?>
</td>
<td>
Added <?php echo $date_added; ?>
</td>
<td>
<?php echo <a href='inventory_edit.php?pid=$id'>edit</a> • ?>
</td>
<td>
<?php echo <a href='inventory_list.php?deleteid=$id'>delete</a><br />"; ?>
</td>
</tr>
</table>
:help: pls help me to solve my desired output,, thanks