Jump to content

Need help on debugging SQL statement


thereaper87

Recommended Posts

Hello there, I have an UPDATE sql state which is giving me some troubles  >:(

 

Here is the update code

$r_time = date("m/j/Y g:i A");
$u_time = date("U");
$news_id = (int)$news_id;
$update_article_rate_up=mysql_query("UPDATE `articles` SET `up_rating`=(`up_rating`+1) AND `avg_rating`=(`avg_rating`+1) WHERE `id`=$news_id") or die("Error updating up rating");

 

$news_id is pulled from the URL. That's it. Nothing else. It is set as an integer.

 

Here is the debugging verision:

$r_time = date("m/j/Y g:i A");
	$u_time = date("U");
	$news_id = (int)$news_id;
	$update_article_rate_up=("UPDATE `articles` SET `up_rating`=(`up_rating`+1) AND `avg_rating`=(`avg_rating`+1) WHERE `id`=$news_id") or die("Error updating up rating");
	echo $update_article_rate_up;

 

This is what it says:

UPDATE `articles` SET `up_rating`=(`up_rating`+1) AND `avg_rating`=(`avg_rating`+1) WHERE `id`=40

 

Which I think is right!

 

 

What is going on here?  :shrug::confused:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.