Jump to content

Recommended Posts

I have this code that works on my hockey website. But basically the same code on the same server just a differnet url works differently. The code is to update the database by one if a certain condition is met. Here is the hockey site code which works.

 

if($score_1a > $score_1b)
     {
       $query = "UPDATE team_names SET wins = (wins + 1), total_points = (total_points + 2) WHERE team_id = '$team_1a_id'";
                      mysql_query($query) or die('Query failed: ' . mysql_error()); 

       $query = "UPDATE team_names SET loss = (loss + 1) WHERE team_id = '$team_1b_id'";
                      mysql_query($query) or die('Query failed: ' . mysql_error()); 
     }

 

 

and here is the one for a message system I am writting. which is adding two to the views instead of one

 

if($_REQUEST['view'] == "yes")
  {
    $id = $_REQUEST['id'];
    $query = "UPDATE email_news SET views = (views + 1) WHERE id = '$id'";                                       
    $result = mysql_query($query) or die('Query failed: ' . mysql_error()); 
  }

 

I dont know what is going on.

 

Thanks

 

Snowdog

The error is that it is adding two to the replies column not one. And in the hoeckey database it only adds one. I think I took the same approch to both updates. Top one works adds one to the current total in the database and the bottom one adds two :(

 

Snowdog

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.