Jump to content

Highscore in tabel!


Joepiooo

Recommended Posts

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

 

This is the PHP Code:

 

<?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!");
?>

 

If someone can help me with this I would be very happy.

 

Thank you

Link to comment
Share on other sites

for($i = 1; $i <= 10; $i++) 
{
if($line = mysql_fetch_assoc($result))
{
<table>
<tr>
<td>
echo $line["name"];
</td>
<td>
echo $line["finalTime"];
</td>
</tr>
</table>
//echo "".$i."=".$line["name"]."".$i."=".$line["finalTime"];
}
}

 

try this

Link to comment
Share on other sites

Hi,

 

Tnx for the reply...

 

But I'm getting this error in Flash when I use that:

 

<br />

<b>Parse error</b>:  syntax error, unexpected '<' in <b>e:\inetpub\vhosts\justenter.nl\httpdocs\script.php</b> on line <b>54</b><br />

 

Link to comment
Share on other sites

Hi,

 

Thank you... This is better... No error but nothing happened! :P

Its still the same and not in a tabel... I think this time its Flash... Dont think that Flash can show me that table because it cant read PHP.

 

Now I have to figure out what to do next ;)

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.