Query Executes in MySQL Command Line, Not From PHP.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux