Can you post the "explain levelone" here?  One thought is that 1contentID
is a char or varchar instead of an int.  Then again, if it were, that exact
code shouldn't have worked.

Are you sure you are doing the query using $sql_element_low and not
something else?  You may be echoing it but are you actually using the query
to execute, or did you copy the mysql_query() command from another line and
forget to change the var?

Also, I hate ". and .", makes for messy life.  Try this:

$sql_element_low = "UPDATE {$table} set medialow=NULL WHERE 

Also, does medialow have a unique index on it?  This could cause it to
fail.  Or is medialow defined as NOT NULL?


On Fri, 15 Nov 2002, Hutchins, Richard wrote:

> 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 (
> To unsubscribe, visit:

Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED]                   

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to