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
https://forums.phpfreaks.com/topic/243874-need-help-on-debugging-sql-statement/
Share on other sites

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.