snowdog Posted June 2, 2007 Share Posted June 2, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/54001-code-works-on-one-website-but-not-another/ Share on other sites More sharing options...
per1os Posted June 2, 2007 Share Posted June 2, 2007 Are you sure the MySQL database and username etc is setup right. What is wrong, is there an error code? Or what? You really didn't specify what the error is. Quote Link to comment https://forums.phpfreaks.com/topic/54001-code-works-on-one-website-but-not-another/#findComment-266947 Share on other sites More sharing options...
snowdog Posted June 2, 2007 Author Share Posted June 2, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/54001-code-works-on-one-website-but-not-another/#findComment-266949 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.