Jump to content

Recommended Posts

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;

Link to comment
https://forums.phpfreaks.com/topic/126238-solved-mysqlphp-problem/
Share on other sites

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

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.