NYCPHP Meetup

NYPHP.org

[nycphp-talk] parse error

Nasir Zubair lists at ny-tech.net
Thu Jun 12 18:22:40 EDT 2003


Ooops, missed your delete syntax error.
 
A delete query is in this format:
 
DELETE FROM table_name WHERE condition='something' 
 
No * between DELETE and FROM.
 
HTH
 
- Nasir
 
-------Original Message-------
 
From: talk at nyphp.org
Date: Thursday, June 12, 2003 5:42:21 PM
To: NYPHP Talk
Subject: [nycphp-talk] parse error
 
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
 
 
--- Unsubscribe at http://nyphp.org/list/ ---
 
 
 
 
.




More information about the talk mailing list