Hello,
(Admin area) I'm trying to have 'Work Overview' to see all the works in each parent categories group and the works must be an order by. I don't really know how to make each categories with all group works.
eg: (repeat rows table and 3 columns in work field)
Category: Catname
Workname1 Date: June 2006 - View/Edit/Delete
Workname2 Date: June 2006 - View/Edit/Delete
and so on
Category: Catname2
Workname3 Date: June 2006 - View/Edit/Delete
Workname4 Date: June 2006 - View/Edit/Delete
and so on
// this is I'm trying to have parent categories group with order by work & date
$query = mysql_query("SELECT * FROM work,category WHERE name AND date AND category ORDER BY date DESC") or die(mysql_error());
$result = mysql_query($query) or die("Couldn't execute query");
while ($row = mysql_fetch_array($query)) {
$date = date( "F Y" );
// this is displaying work overview (haven't put parent category name group row, don't know how to)
$query = mysql_query("SELECT * FROM work") or die(mysql_error());
if(mysql_num_rows($query) == 0)
{
echo "Empty";
}
else
{
echo "<h1>Work Overview</h1> ";
while($row = mysql_fetch_array($query))
{
echo '
<table border="0" cellpadding="2" cellspacing="1" width="750px">
<tr>
<td style="border-bottom:1px solid #ddd;width:250px;"><b>Client: </b>' . $row[name] . '</td>
<td style="border-bottom:1px solid #ddd;width:250px;"><b>Date: </b>' . $row[date] . '</td>
<td style="border-bottom:1px solid #ddd;width:250px;"align="right">
<a href="viewwork.php?view=' . $row[id] . '">View</a> |
<a href="editwork.php?edit=' . $row[id] . '">Edit</a> |
<a href="deletework.php?delete=' . $row[id] . '">Delete</a></td>
</tr>
</table><br/>
';
}
}
I don't think my first SQL is right so I need your help. I have 2 sql tables, one is work and category.
Thanks