469,106 Members | 2,267 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,106 developers. It's quick & easy.

Delete record

Ken
Is this a correct statement to delete a row in a table named "ad_data"?

mysql_query("DELETE FROM ad_data WHERE id = $_SESSION['id']");

The connection is open.

$_SESSION['id'] echo's as 220 which is correct.

id is the primary auto indexed variable.

I have written to ad_data many times but this is my first attempt to delete
a row. I know the database is working.

Is there a permission to delete that must be set. I could not find a means
of setting permissions for the table.

Thanks for the help.

Ken


Jul 20 '05 #1
1 1385
Ken wrote:
Is this a correct statement to delete a row in a table named "ad_data"?

mysql_query("DELETE FROM ad_data WHERE id = $_SESSION['id']");
Make sure your query looks like what it is supposed to look like, for
example like this:

$query = "DELETE FROM ad_data WHERE id = $_SESSION['id']";
echo "Query is: " . $query;
mysql_query( $query );
Is there a permission to delete that must be set. I could not find a means
of setting permissions for the table.


Yes it is possible to give for example only permission to select from
table. Or you can give permission to only select from table.

Try echoing out the query and then copy-paste that query to MySQL via
mysql - console program with the same username and password and you
should get an error message if something is wrong.

If it works correctly from console, you got propably problem with
php-MySQL. Figure out how you can print out error messages in php and
try again to get the error message from there.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Someonekicked | last post: by
9 posts views Thread by Robert Schneider | last post: by
8 posts views Thread by Steve | last post: by
4 posts views Thread by Susan Bricker | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.