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

Discussion and feedback on Construct 2

Post » Fri Oct 13, 2017 10:40 am

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
Posts: 118
Reputation: 1,769

Post » Sat Oct 14, 2017 6:17 am

Posts: 118
Reputation: 1,769

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests