stuff
Posted: Tue Jul 27, 2004 7:59 pm
Hello, ive been working on a script and now its ready to get information from a data base. I created a database called games and a table called gamesinfo and rows called gameName, pubPrice, prvPrice, minPlayer and maxPlayer.
Ive been fooling around with it and with some help from a friend, I was actually able to get the info from the data base in the first drop down menu...its probabley messy but hey what do you want
Now, the one that starts
All help is appreciated,
Thankyou.
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("games",$db);
$result = mysql_query("SELECT * FROM gamesinfo",$db);
if (empty($gameName)) {
//Function Chooses the game
print "Select your game: ";
echo "<select name="gameName">";
while($row = mysql_fetch_assoc($result))
{
extract($row);
$gamename = $row['gameName'];
echo "<option value="$gameName">$gameName</option>\n";
}
echo "</select>";
print "<br><br>";
//END
//Function Player Ammount yields the ammount of players to chose from
print "Select the number of players: ";
$output = '<select name="playerAmmount">';
for($i = 8; $i <= 64; $i += 2) { //replace 8 and 64 with variables from my database
$output .= '<option value="'.$i.'">'.$i.'</option>';
}
$output .= '</select>';
echo $output;
print "<br><br>";
//END
//This displays public/private
echo "Choose weather your server is public or private, private servers require passwords to join:";
echo "<br>
<select name="pubOrPrv">
<option value="$pubPrice">Public Server
</option>
<option value="$prvPrice">Private Server
</option>
</select>";
echo "<br><br>";
//END
//This displays the optional Team Speak server
print "Optional: Team Speak Voice Server:
<br>
Chose the server ammount: ";
$output = '<select name="teamSpeak">';
$output .= '<option value="No Team Speak Server">No</option>';
for($i = 10; $i <= 50; $i += 2) {
$output .= '<option value="'.$i.' Person Team Speak Server">'.$i.'</option>';
}
$output .= '</select>';
echo $output;
print "<br><br>";
//END
echo "<input type="submit" value="Get Price">";
echo "<input type="reset" value="Reset Form">
</form>";
}
###################################
else {
I have some other stuff in here...but I dont want to make the post too big and plus it irrelivent. I would of taken it out but im sure the if..else thing has some kind of inpact.
}
?>Now, the one that starts
I want "8" to be replaced with minPlayers from my database, and 64 be replaced with maxPlayers from my data base.//Function Player Ammount yields the ammount of players to chose from
All help is appreciated,
Thankyou.