|
Subject:
|
Chapter6 delete.php
|
|
Posted By:
|
ghitar1
|
Post Date:
|
8/25/2004 7:23:38 PM
|
OK in the section at the bottom of page 178 under the // generate SQL I have created the code as they say, i even tried it in mysqladmin and it worked. The debug echo prints out the query as... <--DELETE FROM `movie` WHERE `movie_id` = '9' LIMIT 1--> Can anyone let me know what might the cause be. Heres the code...
$sql = "DELETE FROM `".$_GET['type']."` WHERE `".$_GET['type']."_id` = '".$_GET['id']."' LIMIT 1";
echo "<--".$sql."-->";
$result = mysql_error($sql) or die("Invalid Query: " . mysql_error());
Thanks in advance. Derek
|
|
Reply By:
|
Snib
|
Reply Date:
|
8/25/2004 9:19:32 PM
|
So, what's the problem? It doesn't change the database? That may be because you have $result = mysql_error($sql); instead of $result = mysql_query($sql);...
HTH,
Snib
<><
|
|
Reply By:
|
ghitar1
|
Reply Date:
|
8/25/2004 10:08:35 PM
|
duh...you think i looked at the code enough to go blind? omg, thanks for proofreading.
Derek
|
|
Reply By:
|
Ruff D
|
Reply Date:
|
7/29/2006 6:33:31 AM
|
I get the message
Invalid Query: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''' WHERE '_id' = '5' LIMIT 1' at line 1
my coding is seemingly correct (pg 178)
//generate sql $sql = "DELETE FROM '".$_GET['type']."' WHERE '".$_GET['type']."_id' = ".$_GET['id']." LIMIT 1";
|
|
Reply By:
|
Ruff D
|
Reply Date:
|
7/29/2006 7:09:53 AM
|
problem sorted.
can someone tell me the difference with ` and ' particularly when using sql.
|
|
Reply By:
|
tgsqrd
|
Reply Date:
|
9/2/2006 12:21:05 PM
|
ghitar,
Go to http://dev.mysql.com/doc/ download your desired version of the MySQL manual.
I'm using refman 5.1. Beginning on page 577 of my manual, it explains the use of the backtick. I found it using the Index. And, you'll have all of that information right there on your computer.
TG^2
|