Jump to content

I am stumped


Stieny

Recommended Posts

OK. Here is what I am trying to do. I have the conditions set, and if the conditions are met, I want to randomly find a user id, and username from a table, and then store each of these names in the table of the user that is searching.

 

Essentially, a player will search for another player's "location" and be able to select it from a drop down list once it is found. I am fairly sure I can use serialize to store the data, however I am stumped as to how to retrieve the data to store.

 

Any ideas?

Link to comment
Share on other sites

Yes, way past that. Here is what I have so far:

 

$mod = rand (0,100);
$chance = (($user[rangers]*$bonus[rangers]) + ($user[rangers]*$bonus[explore]))*$mod;

	if($user[turns] <= 0)
{
			header('refresh: 4; url= exploration.php');
			echo $error_header;
			echo "You do not have enough turns to do that.";
			echo $footer;
			exit();
}
	if($chance <= 0 and $chance < 199)
{
			header('refresh: 4; url= exploration.php');
			echo $error_header;
			echo "Your rangers have found nothing.";
			echo $footer;
			exit();
}
	if($chance > 200)
{
			$qry="SELECT * FROM members";
			$result = mysql_query($qry);
		while($row = mysql_fetch_array($result))
	{
		$array=array($row[leader]);
	}
			$loc=array_rand($array,1);
			header('refresh: 4; url= exploration.php');
			echo $success_header;
			echo "Your rangers have found $loc.";
			echo $footer;
			exit();
}

Link to comment
Share on other sites

ok, with this code:

      if($chance > 200)
   {
            $qry="SELECT leader FROM members";
            $result = mysql_query($qry);
            $row = mysql_fetch_array($result);		
		$loc=array_rand($row,1);
            header('refresh: 4; url= exploration.php');
            echo $success_header;
            echo "Your rangers have found $loc.";
            echo $footer;
            exit();
   }	

 

I get returns of zero or leader. I would like it to return the name of a leader.

Link to comment
Share on other sites

ok, tried this, but still didn't work....  :confused:

 

      if($chance > 200)
   {
            $qry="SELECT leader FROM members";
            $result = mysql_query($qry);
            $row = mysql_fetch_array($result);		
		$loc=array_rand($row,1);
            header('refresh: 4; url= exploration.php');
            echo $success_header;
            echo "Your rangers have found "; 
		echo $row[$loc[0]];
            echo $footer;
            exit();
   }

Link to comment
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.