uwannadonkey Posted August 8, 2007 Share Posted August 8, 2007 ok, im creating a game online, and i need help with some things: 1) i want to create a table, a ranking table, where a user name is written, and next to it, is the ID, and next row of table has next user with its ID, and so on, i used this code: $sql = 'SELECT display_name FROM users WHERE element = 5'; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { echo $row['display_name']; } $sql = 'SELECT id FROM users WHERE element = 5'; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { echo $row['id']; } and the format shown is : username1,username2 id1 id2 how do i fix this? 2) the site requires cron, i understand how to use the cron commands, but lets say my command line points to cron.php what exactly do i write in the cron.php file? 3) and the part where im totally stumped with is the battle script, where one person attacks the other how would i go about doing that? i asked a couple of coders, and they didnt know, or they gave me some weird response like: use the while loop, and everything, and i was like uhhh, ok? but im still confused. anyone know how i could do this? im eternally grateful if anyone could help me. THANKS Quote Link to comment https://forums.phpfreaks.com/topic/63952-php-help3-problems/ Share on other sites More sharing options...
PC Nerd Posted August 8, 2007 Share Posted August 8, 2007 2) if thres somethign that needs regular updating... like agging xxx amount of money to peoples accounts, put that in the cron. Probably a mysql dump, so export as SQL, and email that sql to yourself... that can be a cron. 3) deoends onteh type of battle. simplest is points vs points, highest wins. then you do that comparison, then do your wining thingy, and if they killed units etc. personally it sounds like you dont know what your game is about, otherwise you would have asked more specific questions etc. gdlk Quote Link to comment https://forums.phpfreaks.com/topic/63952-php-help3-problems/#findComment-318829 Share on other sites More sharing options...
Fadion Posted August 9, 2007 Share Posted August 9, 2007 1) What is the question? What errors are u getting or what isnt working? Anyway from what i can see, maybe this doesnt make the query work 'SELECT display_name FROM users WHERE element = 5'; and must be: "SELECT display_name FROM users WHERE element = '5'"; 3) U need ideas about the battle script! But what kind of game it is? Basically from what i can think, a battle's result is calculated depending on the users levels, number of army they got and whatever. When one attacks the other, get those values and think of an algorithm which determines how many soldiers and stuff are killed depending on the user stats. U need to be clear with the game logic before actually starting programming. And keep in mind that u know what u want to create, not us, so ask detailed questions. Quote Link to comment https://forums.phpfreaks.com/topic/63952-php-help3-problems/#findComment-318967 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.