viewing/updating(editing)/and deletion of records pulled from mysql.
I understand how to do a Delete but am having trouble how to do the
delete when using variables to pull the info from the database.
In this example, I am pulling categories from the DB and would like help
with how to create delete options based on the example.
Code: Select all
$query = mysql_query("SELECT * FROM categories WHERE parentid = 0 ORDER BY catid ASC");
while($cat=mysql_fetch_array($query)){
echo "
<p><a href=\"sub.php?c=$cat[catid]\">$cat[catname]</a>
$cat[description]</p>
";
}Name and link to Category
This would be the category decription.
and to do a delete would be something like
Code: Select all
$cats = mysql_query("DELETE * FROM categories WHERE catid = $this is the problem");to correctly get the catid from the first example.
Just like to say I have been able to delete by manually suggesting what to delete
Code: Select all
$cats = mysql_query("DELETE * FROM categories WHERE catid = 10");function/query/etc