A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: [almost done] Pharaoh's Eye

Threaded View

  1. #14
    Senior Member
    Join Date
    Feb 2004
    Posts
    782
    Hi, what function in flash are you using to post your scores to the php script?

    I generally use:

    Code:
    loadVariablesNum("urlofscorepostingscript",0, "POST");
    And then the following score posting script;

    Code:
    <?php
    
    $db = mysql_connect("localhost", "username", "password") or die("Could not connect.");
    if(!$db) 
    	die("no db");
    if(!mysql_select_db("db_name",$db))
     	die("No database selected.");
    if(isset($_POST['score']))                
    {
      $score=$_POST['score'];
      $name=$_POST['thename'];
      $countscore="SELECT COUNT(*) from asteriodscores";
      $countscore2=mysql_query($countscore);
      $countscore3=mysql_result($countscore2,0);
      if($countscore3<10)
      {
       $insertscore="INSERT into asteriodscores (score,name) values('$score','$name')";
       mysql_query($insertscore) or die("Could not insert score");
       print "Score recorded.";
      }
      else
      {
        $getlowscore="SELECT * from asteriodscores order by score ASC limit 1";
        $getlowscore2=mysql_query($getlowscore) or die("Could not get score");
        $getlowscore3=mysql_fetch_array($getlowscore2);
        if($score>$getlowscore3[score])
        {
          $replace="update asteriodscores set score='$score', name='$name' where ID='$getlowscore3[ID]'";
          $replace2=mysql_query($replace) or die(mysql_error());
          print "Score recorded.";
        }
        
     }
    
        
    }
    ?>
    Last edited by Archbob; 04-03-2006 at 05:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center