Forum Moderators: coopster

Message Too Old, No Replies

MySQL Query Question

         

wfernley

3:03 pm on Apr 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello :)

Alright I have an easy question. For some reason my stupid script will not work and its annoying me because I know its an easy answer, but I just don't know it.

Basically, I am trying to delete something from a table using a string variable.

$tsremove = "Available for All Windows Platforms";
$tscat = "solutions";
mysql_query("DELETE FROM techspecs_'$tscat' WHERE '$tscat' = '".$tsremove."'");

So the mysql_query should be DELETE FROM techspecs_solutions where solutions = "Available for All Windows Platforms";

What exactly am I doing wrong? Sorry for asking such a noob question :P

Wes

coopster

4:31 pm on Apr 28, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Try this, you'll notice your issues immediately:
$sql = "DELETE FROM techspecs_'$tscat' WHERE '$tscat' = '".$tsremove."'"; 
exit($sql); // get rid of this line after troubleshooting!
mysql_query($sql);

It will output this...

DELETE FROM techspecs_'solutions' WHERE 'solutions' = 'Available for All Windows Platforms'

Now you can start fixing your statement...