Im having the same sort of problem, but im using PHPmyadmin! If it helps i am trying to create the CMS on page 206 in Sitepoint book BYO database driven website in php & mysql.
When i hit the delete button its supposed to delete an author and all related data in other tables. It deletes the author but fails to remove the primary key id in phpmyadmin? So im left with blank results (bullit point) on the page with a edit and delete next to it.
This is my code (sorry for length)
[B]if (isset($_POST[‘action’]) and $_POST[‘action’] == ‘Delete’)
{
include $_SERVER[‘DOCUMENT_ROOT’] . ‘/includes/dbcon.inc.php’;
$id = mysqli_real_escape_string($link, $_POST['id']);
$sql = "SELECT id FROM soulfire_joke WHERE authorid='$id'";
$result =mysqli_query($link, $sql);
if (!result)
{
$error = 'Error Getting list off jokes to delete!';
include 'error.html.php';
exit();
}
while ($row = mysqli_fetch_array($result))
{
$jokeId = $row[0];
$sql ="DELETE FROM soulfire_jokecategory
WHERE jokeid='$jokeId'";
if(!mysqli_query($link, $sql))
{
$error = 'Error Deleting category enteries for joke!';
include 'error.html.php';
exit();
}
}
$sql = "DELETE FROM soulfire_joke WHERE authorid = '$id'";
if(!mysqli_query($link, $sql))
{
$error = 'Error deleting jokes for author!';
include 'error.html.php';
exit();
}
$sql = "DELETE * FROM soulfire_author WHERE id='$id'";
if(!mysqli_query($link, $sql))
{
$error = 'Error deleting the author';
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}
[/B]