Web Based Admin Probs
Posted: Thu Sep 29, 2005 9:58 pm
I am attempting to create a webbased admin that allows for
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.
Which the above could create something like
Name and link to Category
This would be the category decription.
and to do a delete would be something like
I cant seem to figure out how to assign the 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
Its the dang variables I am again having trouble with to work in unison regardless of the
function/query/etc
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