I'm working on a super simple database and php script. The problem is I can't get it to work!
I keep getting this error "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /Library/Tenon/WebServer/WebSites/www.ABCAdvertising.net/abcadmin/dcloset.php on line 28", line 28 is "while ($row_shorts = mysql_fetch_assoc($result_shorts))".
Here is the php page(just trying to get the shorts column to work right now).
<?PHP
include('include/user_check.php');
include('include/db_con.php');
?>
<html>
<head>
<title>D Closet</title>
</head>
<body>
<table>
<tr>
<th colspan="2">SHORTS</th><th colspan="2">JEANS</th><th colspan="2">POLOS</th><th colspan="2">T-Shirts</th>
</tr>
<tr>
<th>Amount</th><th>Color</th><th>Amount</th><th>Color</th><th>Amount</th><th>Color</th><th>Amount</th><th>Color</th>
</tr>
<?PHP
$query = "SELECT type FROM dc";
$result_query = mysql_query($query);
* while ($row_query = mysql_fetch_assoc($result_query))
{
$type = $row_query['type'];
}
$shorts = "SELECT color, number FROM dc WHERE '$type' = shorts";
$result_shorts = mysql_query($shorts);
while ($row_shorts = mysql_fetch_assoc($result_shorts))
{
$number_shorts = $row_shorts['number'];
$color_shorts = $row_shorts['color'];
?>
<tr>
<td><?=$number_shorts; ?></td><td><?=$color_shorts; ?></td><td><?=$number_jeans; ?></td><td><?=$color_jeans; ?></td><td><?=$number_polos; ?></td><td><?=$color_polos; ?></td><td><?=$number_tshirts; ?></td><td><?=$color_tshirts; ?></td>
</tr>
<?PHP
}
?>
</table>
</body>
</html>
Here is what the entire database table looks like
type_colornumber
shortsblue2
jeansblack3
poloswhite4
tshirtsgreen___1