|
-
Aug 4th, 2005, 10:00 AM
#1
New Member
Re: Cannot delete a row with PHP & MySQL
I think you're forgetting there have to be quotes round the string in the query.
So I think it's like this:
Code:
$result = mysql_query("DELETE FROM '" . $data[0] ."' WHERE ID IN '" .$data[1] . "'");
I added the single quotes... (if ID is a number in your database, you can delete the single quotes there)
I hope it works, it's my first post here on the forum, and i just know the basics of PHP/MySQL, so don't shoot me if I'm wrong.
-
Aug 5th, 2005, 01:05 AM
#2
Re: Cannot delete a row with PHP & MySQL
 Originally Posted by n0vembr
did u try manually executing the statement in a query analyzer tool?
Ran the same statement in PHP Admin and it worked fine.
 Originally Posted by visualAd
You need to use urly brackets to enclose arrays:
{ }
Code:
$result = mysql_query("DELETE FROM {$data[0]} WHERE ID IN({$data[1]})");
What? I have several statements which alter rows and insert rows with arrays and they work fine without brackets. Why would delete require them? I'll try it just to double check but I don't understand that.
 Originally Posted by visualAd
Use echo() to output the query text an ensure it is what you expect. Then try n0vemberssuggestion of executing that exact text on the command line.
Havn't had the chance of using echo or print. I'm going to give this a try later but it seems the issue is specifically with the sql query
 Originally Posted by Geert
I think you're forgetting there have to be quotes round the string in the query.
Shouldn't matter and I've tried that anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|