Linjon Posted March 21, 2010 Share Posted March 21, 2010 Hello. If i change player_id to 2 then player with id 2 gets points and if 3 then player with id 3 gets points. How can i do that dynamic (if player "user321" have id 5 and he send sms with his username then he get points) ? <?php $dbhost = 'localhost'; $dbuser = '********'; $dbpass = '********'; $dbname = '********; mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error()); mysql_select_db("$dbname") or die(mysql_error()); $result = mysql_query("SELECT `player_id` FROM `w3_player` WHERE `player_name` ='".$_GET['message']."'") or die(mysql_error()); if(mysql_num_rows($result) != 1) { echo " No user found" exit; }else{ $addexp = 75000; $id = mysql_query("SELECT `tablename` `player_id` FROM `w3_player` WHERE `player_name` ='".$_GET['message']."'"); mysql_query("UPDATE `database`.`w3_player_race` SET `race_exp` = `race_exp` + ".$addexp." WHERE `w3_player_race`.`player_id` = '1'' AND `w3_player_race`.`race_id` =1"); echo "Points added"; } ?> Link to comment https://forums.phpfreaks.com/topic/195992-mysql-insert-or-smth/ Share on other sites More sharing options...
Linjon Posted March 24, 2010 Author Share Posted March 24, 2010 Btw i have to use sprintf( "player_id = %d", $five ) or "player_id = " . (int)$five But i dont know how to do it :/ Help please? Link to comment https://forums.phpfreaks.com/topic/195992-mysql-insert-or-smth/#findComment-1030955 Share on other sites More sharing options...
Linjon Posted March 29, 2010 Author Share Posted March 29, 2010 Still need help :/ Link to comment https://forums.phpfreaks.com/topic/195992-mysql-insert-or-smth/#findComment-1033616 Share on other sites More sharing options...
cunoodle2 Posted March 29, 2010 Share Posted March 29, 2010 Give us a little more info on this. Answer the following questions.. 1) What is happening? 2) What do you think SHOULD be happening? 3) What error messages are you getting if any? 4) Can you explain the situation a little bit more please? I'm a little unclear as to what you actually need. All that you have here is an insert statement. No one here is going to write code/functions for you. We only help troubleshoot existing items/issues. I'll come back and check on this tomorrow. If the above 4 questions are not answered more code provided then I will just move on to help another poster whom put a little more time into his work. Link to comment https://forums.phpfreaks.com/topic/195992-mysql-insert-or-smth/#findComment-1033695 Share on other sites More sharing options...
Linjon Posted April 1, 2010 Author Share Posted April 1, 2010 1) What is happening? 2) What do you think SHOULD be happening? 3) What error messages are you getting if any? 4) Can you explain the situation a little bit more please? I'm a little unclear as to what you actually need. Okei. 1) Nothing happening 2) Someone send SMS with his username and script will add points to user. 3) I dont get errors 4) I have `player_id` = '1' (thats player id for first user on database). I need make this script to automatic ( if second user on database send sms then he will get points. I will reply if you have any questions. Link to comment https://forums.phpfreaks.com/topic/195992-mysql-insert-or-smth/#findComment-1035285 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.