After Bullant's message I tried this but got the message "could not run query". I know I did something wrong but I don't know what.
<?php
// Connect to the MySQL database
include "storescripts/connect_to_mysql.php";
// Run a select query to get latest item from each subcategory
$dynamicList = "";
$queryA = array(
"SELECT * FROM products WHERE category='Apparel' AND subcategory='Dresses' ORDER BY date_added DESC LIMIT 1",
"SELECT * FROM products WHERE category='Apparel' AND subcategory='Skirts' ORDER BY date_added DESC LIMIT 1",
"SELECT * FROM products WHERE category='Apparel' AND subcategory='Coats' ORDER BY date_added DESC LIMIT 1",
"SELECT * FROM products WHERE category='Apparel' AND subcategory='Shorts' ORDER BY date_added DESC LIMIT 1"
);
foreach ($queryA as $query) {
$rs = @mysql_query($query, $conn) or die('Could not run query');
while ($row = mysql_fetch_assoc($rs)) {
$id = $row["id"];
$product_name = $row["product_name"];
$subcategory = $row["subcategory"];
$dynamicList .= '
<ul>
<li><a href="Apparel/' . $subcategory . '.php"><img src="inventory_images/' . $id . '_1.jpg" alt="' . $product_name . '" width="140" height="210" border="0" /></a>
<center><h3>' . $subcategory . '</h3></center>
</li>
</ul>';
}
}
mysql_free_result($rs);
?>
Then I tried yours and got a Parse error: syntax error, unexpected T_STRING. I know I sound really stupid right now but I'm doing this site for a friend and before this I had only created HTML/CSS based sites, so this is all very new and confusing for me