Hi guys. I'm trying to run the query to show something like:
Event Name
| Year | Category | Photo ID# |
| Year | Category | Photo ID# |
Event 2 Name
_ | Year | Category | Photo ID# |
So what I've come up with is this:
<form method="POST">
<table class="approve">
<input type="hidden" name="submitted" value="true">
<tr>
<th></th><th>Year</th><th>Category</th><th>Photo ID</th>
</tr>
<?
$query = "SELECT * FROM `Years` a, `Categories` b, `Events` c, `Photos` d GROUP BY d.peid ORDER BY d.peid ASC";
$result = mysql_query($query) or die("<b>".mysql_error()."</b><br />");
$items = mysql_fetch_array($query) ;
echo $result."<br />".$items;
while($item = mysql_fetch_array($result)){
echo "<tr><td colspan='4'><b><i>".$item['Event']."</i></b></td></tr>";
$selsql = "SELECT * FROM `Years` a, `Categories` b, `Photos` c WHERE c.peid = '".$item['peid']."' ORDER BY c.pid ASC";
$selrsl = mysql_query($selsql);
while($_item = mysql_fetch_array($selrsl)){
echo "<tr>\n
<td><input type='checkbox' name='photo[]' value='".$_item['pid']."' /></td>
<td>".$_item['Year']."</td>\n
<td>".$_item['Category']."</td>\n
<td>".$_item['pid']."</td>\n
</tr>";
}
}
?>
<tr>
<td colspan='4'>
<input type="submit" value="APPROVE" name="mode" /> || <input type="submit" value="DISAPPROVE" name="mode" />
</td>
</tr>
</table>
</form>
When I show the $result I get:
Resource id #9 <-- Expected
When I try to retrieve it into an array, it gives me nothing. It won't enter the while() loop (hence why I added teh lines:
$items = mysql_fetch_array($result);
echo $items
And that displays nothing. You can see it here:
Photo Administration Test
Thanks for any help you can offer.
~Brett