Jump to content
MakeWebGames

Need base code to work off.


radio_active

Recommended Posts

Re: Need base code to work off.

 

//Your starting number & Ending number
$start_point = 0;
$end_pont = 5;


for($i = $start_point; $i < $end_point; $i++) 
//What we do here is the following:
// $i = $start_point == your starting number
// $i = $end_point == your ending number
// $i++ == counts to that number to stop


//Start the loop
{

//echo out your restult
echo $i.'
';


//close the loop
}

 

Hope thats a good description to help you.

Link to comment
Share on other sites

Re: Need base code to work off.

I think a while function would be best.

 

//Your ids bellow
$array = array(1,2,3);

//Fetch rows
$row = mysql_query("SELECT userid FROM users WHERE userid=1 AND userid=2 AND userid=3");

//Count / leave
$i = -1;

//fetch $row values
while($soc = mysql_fetch_assoc($row))

//open loop
{
//random number
$rand = rand(1,10);

//count up
$i++

//Event user with random number
event_add($soc[$array[$i]],"Random Number: ".$rand.".");

//if $i = 3 exit script and cloose loop
if($i == 2)
{
	exit;
}

//End loop
}

 

That should help i hope. :lol:

Link to comment
Share on other sites

Re: Need base code to work off.

Hmmmm, i dont think that will do it. Im selecting three IDs from a table that i have. A userid is in each ID (Not selecting from the users table)

Then once they are selected im sending three differents precentages of money out of a total lot. The reason i need the loop is obviously for looping the Event ad and the update money etc and i thought the counter for the different percentages being sent which is why i came to the conclusion of a for() loops witha counter, lol...

Ill contact you on msn.

Link to comment
Share on other sites

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.   Paste as plain text instead

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