//Connecting to your local database
$host="localhost";
$username="eoserv";
$password="eoserv";
$dbname="eoserv";
$con=mysql_connect($host,$username,$password);
if ($con) //if you have successfully connected to your database
{
//execute this code
}
else
{
die ('could not connext: '. mysql_error()); //print the error message
}
| : //Connecting to your local database
: $host="localhost";
: $username="eoserv";
: $password="eoserv";
: $dbname="eoserv";
: $con=mysql_connect($host,$username,$password);
: if ($con) //if you have successfully connected to your database
: {
: //execute this code
: }
: else
: {
: die ('could not connext: '. mysql_error()); //print the error message
: }
|
//Connecting to your local database
$host="localhost";
$username="eoserv";
$password="eoserv";
$dbname="eoserv";
$con=mysql_connect($host,$username,$password);
if ($con) //if you have successfully connected to your database
{
//The following code is to be executed on database connection
mysql_select_db($dbname);
$sql="SELECT * FROM Characters ORDER BY Level DESC"; //From step 2 of the tutorial
$result=mysql_query($sql); //Executing the query to return the result from the database
while ($row=mysql_fetch_array($result)) //while there are still rows to return from the database
{
echo("Character name: ".$row["name"]." level: ".$row["level"]."<br>"); //this prints the character name, and his or her level in descending order so the player with the highest level will be printed first.
}
}
else
{
die ('could not connext: '. mysql_error()); //print the error message
}
| : //Connecting to your local database
: $host="localhost";
: $username="eoserv";
: $password="eoserv";
: $dbname="eoserv";
: $con=mysql_connect($host,$username,$password);
: if ($con) //if you have successfully connected to your database
: {
: //The following code is to be executed on database connection
: mysql_select_db($dbname);
: $sql="SELECT * FROM Characters ORDER BY Level DESC"; //From step 2 of the tutorial
: $result=mysql_query($sql); //Executing the query to return the result from the database
: while ($row=mysql_fetch_array($result)) //while there are still rows to return from the database
: {
: echo("Character name: ".$row["name"]." level: ".$row["level"]."<br>"); //this prints the character name, and his or her level in descending order so the player with the highest level will be printed first.
: }
: }
: else
: {
: die ('could not connext: '. mysql_error()); //print the error message
: }
|
//Connecting to your local database
$host="localhost";
$username="eoserv";
$password="eoserv";
$dbname="eoserv";
$con=mysql_connect($host,$username,$password);
if ($con) //if you have successfully connected to your database
{
//The following code is to be executed on database connection
mysql_select_db($dbname);
$sql="SELECT * FROM Characters ORDER BY Level DESC"; //From step 2 of the tutorial
$result=mysql_query($sql); //Executing the query to return the result from the database
$count=0; //initializing the $count vairable.
while ($row=mysql_fetch_array($result) && $count<100) //while there are still rows to return from the database and while the count variable is less than 100.
{
echo("Character name: ".$row["name"]." level: ".$row["level"]."<br>"); //this prints the character name, and his or her level in descending order so the player with the highest level will be printed first.
$count++; //incrementing the count variable by 1. if $count=1, $count now equals 2.
}
}
else
{
die ('could not connext: '. mysql_error()); //print the error message
}
| : //Connecting to your local database
: $host="localhost";
: $username="eoserv";
: $password="eoserv";
: $dbname="eoserv";
: $con=mysql_connect($host,$username,$password);
: if ($con) //if you have successfully connected to your database
: {
: //The following code is to be executed on database connection
: mysql_select_db($dbname);
: $sql="SELECT * FROM Characters ORDER BY Level DESC"; //From step 2 of the tutorial
: $result=mysql_query($sql); //Executing the query to return the result from the database
: $count=0; //initializing the $count vairable.
: while ($row=mysql_fetch_array($result) && $count<100) //while there are still rows to return from the database and while the count variable is less than 100.
: {
: echo("Character name: ".$row["name"]." level: ".$row["level"]."<br>"); //this prints the character name, and his or her level in descending order so the player with the highest level will be printed first.
: $count++; //incrementing the count variable by 1. if $count=1, $count now equals 2.
: }
: }
: else
: {
: die ('could not connext: '. mysql_error()); //print the error message
: }
|