Jump to content

Code works on one website but not another


snowdog

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

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.