Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/63952-php-help3-problems/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/63952-php-help3-problems/#findComment-318829
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/63952-php-help3-problems/#findComment-318967
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.