Jump to content

what's wrong with this query?


sk121506

Recommended Posts

$query  = "UPDATE ('$keyarray['item_name'.$i]')||'_'||('$keyarray['option_selection2_'.$i]') SET AdvertiserID=('$_SESSION['username']') WHERE AdvertiserID='0' AND Day=('$keyarray['option_selection1_'.$i]') AND ('$keyarray['option_selection2_'.$i])_Id=('$randNums')";

 

($randNums is an array)

 

in english after all the paypal variables pass through i would like it to read...

UPDATE January_Ad1 SET AdvertiserID=(the user logged in) WHERE AdvertiserID='0' AND Day=1 AND Ad1_Id=(the random numbers that were generated before the query)

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/86509-whats-wrong-with-this-query/
Share on other sites

Whenever you put variables in double-quoted string, enclose them in curly brackets, like so:

$audience = 'World';
echo "Hello, {$audience}!";

 

If you're having trouble with your query, echo it before you send it to the DB:

echo $query;

Is it what you expected?

 

If it looks like it is, execute it with a die() statement:

mysql_query($query) or die(echo 'Error: ' . mysql_error());

 

You didn't specify what you did to trouble shoot the problem, so I have to assume you didn't do anything.  Programs don't fix themselves, programmers have to trouble shoot them.  When something stops working in your house, a light bulb for example, do you just stare at it blankly and give up?  Or do you try and figure out why?  Same thing with debugging. ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.