I want to delete the author names from a table and with the code which I've written I am able to do that.But, in my table i also have author names who has'nt written any books.
Can i only get the list of author names who has'nt written any books.I've AUT_ID in my TBL_BOOKS.
would anybody help me how to re-write my code.
Many thanks
Ok, i've 2 tables TBL_AUTHORS and TBL_BOOKS.
I wanting to delete the author name from the TBL_AUTHORS.
<?
if (isset($delete)) {
// delete author name
$sql = "DELETE FROM TBL_AUTHORS WHERE AUT_ID=$id";
$result = mysql_query($sql);
}
// print the list of author names
$result = mysql_query("SELECT * FROM TBL_AUTHORS ORDER BY AUT_NAME ");
?>
<table width="75%" border="1" cellspacing="1">
<?PHP
while ($myrow = mysql_fetch_array($result)) {
?>
<tr>
<td><?PHP echo $myrow['AUT_NAME']; ?></td>
<td><a href="<?PHP echo $_SERVER['PHP_SELF']; ?>?id=<?PHP echo $myrow['AUT_ID']; ?>&delete=yes">
<img src="delete.gif" width="20" height="19" border="0"></a></td>
</tr>
<?PHP
};
?>
</table>