Query Executes in MySQL Command Line, Not From PHP.

From: Date: Fri, 15 Nov 2002 20:53:20 +0000
Subject: Query Executes in MySQL Command Line, Not From PHP.
Groups: php.db 
Request: Send a blank email to php-db+get-23401@lists.php.net to get a copy of this message
I'm having problems with a query. The query as it reads in my code is: $sql_element_low = "UPDATE $table SET medialow=NULL WHERE ".$_POST["tbl"]."contentID=".$_POST["id"].""; All of the varibles get passed as expected. I know this because if I echo the SQL out to the page, I get: UPDATE levelone SET medialow=NULL WHERE 1contentID=1 When I type the echoed SQL directly into the MySQL command line, the query executed just fine. However, when I try to let the code execute the query, nothing happens. No, mysql_error(), nothing. All of the surrounding code is found below. $sql_media fires just fine and deletes what it is supposed to. However, when the $sql_element_low query gets called, it'll echo out just fine, but won't execute. if(isset($_POST["delete"]["medialow"])){ $sql_media = "DELETE FROM media WHERE mediaID=".$_POST["mediaID"][0].""; //echo $sql_media."</br>"; mysql_query($sql_media) or die(mysql_error()); $table = tableNumToName($_POST["tbl"]); $sql_element_low = "UPDATE $table SET medialow=NULL WHERE ".$_POST["tbl"]."contentID=".$_POST["id"].""; echo $sql_element_low."<br>"; mysql_query($sql_element_low) or die(mysql_error()); } Any ideas? Thanks, Rich

« previous php.db (#23401) next »