Hey everybody. So I am just trying to write a script to delete a row in a MySQL database. Unfortunately I seem to have something wrong...even though I don't get any errors.

Here is a snippet of the code on the page to send the request:

echo "<tr><td width='138px' height='104px' valign='middle' rowspan='4'>" .
    "<img src='../$amv_thumbnail' border='0' align='center' /></td>" .
    "<td>$amv_name</td>" .
    "<td>$amv_length</td>" .
    "<td>$amv_creator</td>" .
    "<td>$amv_studio</td></tr>" .
    "<tr><td colspan='4'>$amv_url</td></tr>" .
    "<tr><td colspan='4'>$amv_creator_url</td></tr>" .
    "<tr><td colspan='4'><div style='text-align: right;'>" .
    "<a href='javascript:void(0)' onClick='javascript:sendRequest(\"deleterow.php?id=" .   $id . "\", \"viewer\")'>Remove AMV</a></div></td></tr>";

I have checked that the 'id' that was passed was correct. So I know that the code above is working. 'is' is not displayed as a variable above as it isn't directly used in the table. SELECT id, ... FROM amvs...while(list($id,...))

Here is the code from the deleterow.php script:


$dbc = mysqli_connect('server', 'username', 'password', 'database')
or die('Error  connecting to MySQL server.');

$id = $_GET['id'];
die("No ID passed");

$sql = "DELETE FROM amvs WHERE id='$id'";
$result = mysqli_query($sql)
or die('Error Deleting Record');

Echo "AMV Removed Successfully";

include_once 'getamvs.php';



The only message I get (plus the included page) is AMV Removed Successfully. However if I go to my phpMyAdmin the row is still there and it also shows up in the returned query below the message.

Can someone see something that I'm not?

Edited by UzuNarU: Typo

7 Years
Discussion Span
Last Post by UzuNarU

LoL seems my server was just having a heart attack. Plus I forgot one tiny piece of code.

$result = mysqli_query($dbc, $sql)
or die('Error Deleting Record');

All is good now. Hope my find help someone else out.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.