NYCPHP Meetup

NYPHP.org

parse error

Tim Toomey ttoomey at ydnt.com
Thu Jun 12 19:42:03 EDT 2003


I'm having trouble with this simple little script I have to delete a row from mysql. Users click on the delete link, then have a chance to make sure they want to delete the row and if they click the "yes" radio it executes this portion of the script:

if (isset($_POST['delete_yes'])) {
$_POST['id'] = $id
$delete_query = "DELETE * FROM products WHERE id = '$id'";
$do_delete_query = mysql_query($delete_query) or die(mysql_error()); 
echo ("Successfully deleted product.<BR><BR>");
echo ("<a href='index.php'>Return to Product DB Admin.</a>");
}

the $_POST['id'] is just a hidden field that grabs the id from the get variable ID. This looks a little odd to me, but I still can't understand why it won't work

I've tried changing the $delete_query to
$delete_query = DELETE * FROM products WHERE id = $_POST['id']; but then I get T_Variable parse errors.

Anyone know how to fix this?

-timmy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030612/64462e2c/attachment.html>


More information about the talk mailing list