Computing.Net > Forums > Database > PHP / MySQL Problem

PHP / MySQL Problem

Reply to Message Icon

Original Message
Name: suspect52732
Date: October 10, 2007 at 14:38:19 Pacific
Subject: PHP / MySQL Problem
OS: XP
CPU/Ram: 2.4/512
Comment:

I have a rating script that works great. What I am tring to do, is each time a user votes, I will add some voting expierence to there account. This code seems to have a glitch in it. It works, and does what it is supposed to. However, when I put this code in, you have to refresh the page to view the results, without this code, you dont have to refresh the page to view the code. Any ideas? Perhaps my code is written poorly?


if($session->logged_in){
$req_username = $session->userinfo['username'];
$query = mysql_query("SELECT * FROM users WHERE username = '$req_username'");
$myExp = mysql_fetch_assoc($query);
$myVoteExp = $myExp['voteExp'];
$myVoteExp = $myVoteExp + 1;
$query = mysql_query("UPDATE users SET voteExp = '$myVoteExp' WHERE username = '$req_username'");
$applyMyExp = mysql_fetch_assoc($query);
}


Report Offensive Message For Removal

Response Number 1
Name: suspect52732
Date: October 10, 2007 at 14:40:31 Pacific
Subject: PHP / MySQL Problem
Reply: (edit)

Sorry if the last bit was confusing...

However, when I put this code in and use it, you have to refresh the page to view the results of the vote cast. When I leave this code out, you dont have to refresh the page to view the voting results. Any ideas? Perhaps my code is written poorly?


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PHP / MySQL Problem

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software