Highscore in tabel!
Posted: Thu Apr 08, 2010 2:02 am
Hi,
I made a Highscore system with Flash PHP and MyQSL. Its sending and getting info from Myqsl and is putting it out in Flash.
But its shown like this:
Here are all the flash scores in our database: name1=Wilfinal1=2000name2=Test
final2=1234name3=Zzyzxfinal3=1000name4=Testfinal4=1000name5=Peterfinal5=44name6=
asdasdfinal6=25name7=Gekheid
final7=20name8=Nick
final8=16name9=
pietjefinal9=11name10=Truusfinal10=2The data has been written to the table!?>
I want to have it in a nice tabel... Is this something I have to do with PHP or Flash?
Dont know where to begin to be honest... I allready tried to adjust it in PHP but that aint working very wel..
If someone can help me with this I would be very happy.
Thank you
I made a Highscore system with Flash PHP and MyQSL. Its sending and getting info from Myqsl and is putting it out in Flash.
But its shown like this:
Here are all the flash scores in our database: name1=Wilfinal1=2000name2=Test
final2=1234name3=Zzyzxfinal3=1000name4=Testfinal4=1000name5=Peterfinal5=44name6=
asdasdfinal6=25name7=Gekheid
final7=20name8=Nick
final8=16name9=
pietjefinal9=11name10=Truusfinal10=2The data has been written to the table!?>
I want to have it in a nice tabel... Is this something I have to do with PHP or Flash?
Dont know where to begin to be honest... I allready tried to adjust it in PHP but that aint working very wel..
Code: Select all
<?php
////////// FILL IN THIS INFORMATION HERE! ////////////
$host = "localhost"; //hostname is usually localhost by default
$user = "****"; //insert the name of the user here
$pass = "****"; //insert the password here
$database = "****"; //insert name of database wherein table was exported
$table = "****"; //insert the name of the table
////////////////////////////////////////////////////////
//stores the URLvariables into variables that php can use
$one = $_GET['name'];
$five = $_GET['final'];
// Connects to the database server
// outputs an error message is it was unsuccessful
$dbcnx = @mysql_connect($host,$user,$pass);
if (!$dbcnx) {
echo( "<P>Unable to connect to the database server at this time.</P>" );
exit();
}
// Selects the specified database
if (! @mysql_select_db($database) ) {
echo( "Unable to find database" );
exit();
}
echo("Here are all the flash scores in our database: ");
// Request all the data from the table
$result = mysql_query("SELECT * FROM {$table} ORDER BY finalTime DESC");
if (!$result) {
echo("<P>Error performing query: mysql_error() </P>");
exit();
}
// Display the first three records
//for($x=0;$x <6;$x++)
//{
// $row = mysql_fetch_array($result);
// echo "Name : {$row["name"]}" .
// "Final Time : {$row["finalTime"]}";
//}
for($i = 1; $i <= 10; $i++) {
if($line = mysql_fetch_assoc($result)){
echo "".$i."=".$line["name"]."".$i."=".$line["finalTime"];
}
}
//this is the command used to write the record into the MySQL database
$query="INSERT into {$table} (name,finalTime) VALUES ('{$one}',{$five})";
//executes the command
mysql_query($query) or die("Data not written.");
echo("The data has been written to the table!");
?>Thank you