Can i request just 1 score from table of highscores in php?

0 favourites
  • 2 posts
From the Asset Store
Paypal PHP Supports multiple platforms, Web/html5 Android, IOS. (Including storing transaction data)
  • Hi,

    i have created a high-score table in database of a server for my game with the help of this tutorial -'

    Now whenever i request php it gives me a list of top scores i.e. names against there scores

    I just wanted to know that is it possible to request just the score against a particular name only?

    For example : I have store this table on server database Rank Name Score

    -------------------------------------------------------------------------------- 1 -------Harry----1000

    -------------------------------------------------------------------------------- 2 -------Sam------700


    -------------------------------------------------------------------------------- 12 -------Monica-500

    Is there a way to request the score against name "monica" only? (by editing code in php_request)

    The php i am currently using is this...


    header('Access-Control-Allow-Origin: *');

    $host="localhost"; // Host name

    $username="username"; // Mysql username

    $password="password"; // Mysql password

    $db_name="database"; // Database name

    $tbl_name="scores"; // Table name

    // Connect to server and select database.

    mysql_connect("$host", "$username", "$password")or die("cannot connect");

    mysql_select_db("$db_name")or die("cannot select DB");

    // Retrieve data from database

    $sql="SELECT * FROM scores ORDER BY score DESC LIMIT 10";


    // Start looping rows in mysql database.


    echo $rows['name'] . "|" . $rows['score'] . "|";

    // close while loop


    // close MySQL connection



    I have been struggling with this question for a while now, have searched a lot but nothing to help with this.

    Please please kindly help...

    Thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Edit :

    Found the answer


    Thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)