RobertSubnet Posted September 29, 2008 Share Posted September 29, 2008 Greetings all. For some reason I cannot get the bit of code below to work. What it is supposed to do is 1. read the current number of positive reviews and then increase the number of positive reviews by 1. The $query62 is not updating the users table but I cannot find a fault in the coding. The MySQL field type is an int(7) unsigned default '0' not null I have the error reporting set to E_ALL and PHP is not complaining. Just for grins, I had php display the values of the following variables: the value of row is: the value of fixed pos is: the value of increase pos is: 1 So $increase_pos has a value. I don't understand why it is not updating my users table with that value. Any suggestions would be much appreciated. Thanks! Switch ($review) { case "positive": $_one = 1; /*Get the current number of positive (pos) reviews and increase by one. */ $query_pos = "Select positive_sales from users where login_name = '$seller_name'"; $result_pos = mysql_query($query_pos); $row = mysql_fetch_assoc($result_pos); $fixed_pos = $row['positive_sales']; $increase_pos = ($fixed_pos + $_one); $query62 = "update users set positive_sales = '$increase_pos' where login_name = '$seller_name'"; $result62 = mysql_query($query62); break; Quote Link to comment https://forums.phpfreaks.com/topic/126238-solved-mysqlphp-problem/ Share on other sites More sharing options...
Barand Posted September 29, 2008 Share Posted September 29, 2008 All you need is $query62 = "update users set positive_sales = positive_sales + 1 where login_name = '$seller_name'"; $result62 = mysql_query($query62); Quote Link to comment https://forums.phpfreaks.com/topic/126238-solved-mysqlphp-problem/#findComment-653195 Share on other sites More sharing options...
RobertSubnet Posted September 29, 2008 Author Share Posted September 29, 2008 Barand: Thanks! I rewrote the query the way you suggested and it still did not work. I then checked the value of $seller_name and it came up as a MySQL Resource ID. After running the $seller_name query through mysql_fetch_assoc, everything else worked the way it should. Thanks again for your help! ~Robert Quote Link to comment https://forums.phpfreaks.com/topic/126238-solved-mysqlphp-problem/#findComment-653372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.