Help on Highscore Table

0 favourites
  • 14 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • How to create high score table,

    With Construct 2 AJAX / PHP WITH MYSQL OR PHP WITH TXT FILE

  • Not working..

    -------------------------------

    i create this php mysql database to post data but writes as invisible records..

    ------------------------------------------

    <?php

    $host="localhost"; // Host name

    $username="root"; // Mysql username

    $password=""; // Mysql password

    $db_name="demo"; // Database name

    $tbl_name="demo"; // 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");

    $name = $HTTP_GET_VARS[name];

    $hiscore = $HTTP_GET_VARS[hiscore];

    // Insert data into mysql

    $sql="INSERT INTO $tbl_name(name, hiscore)VALUES('$name', '$hiscore')";

    $result=mysql_query($sql);

    // if successfully insert data into database, displays message "Successful".

    if($result){

    echo "Successful";

    }

    else {

    echo "ERROR";

    }

    // close connection

    mysql_close();

    ?>

    -----------------------------------------------------

    and constuct 2 create 2 fields text box

    and submit button with code...

    AJAX | Request "http://localhost/score/score.php" (tag"")

    -------------------------------------------------------

    work but in mysql writes as invisible records

  • But you're not passing the texts trough the URL!

    Request this:

    "http://localhost/score/score.php?name="&TextBoxObjectForName.Text&"&hiscore="&TextObjectForScore.Text

    Attention on " and &, just change the bold text. ;)

    Also i suggest you change

    $name = $HTTP_GET_VARS[name];

    $hiscore = $HTTP_GET_VARS[hiscore];

    To

    $name = $_GET['name'];

    $hiscore = $_GET['hiscore'];

    The var $HTTP_GET_VARS is deprecated in PHP (i know it's that wy on tuto, but believe me :) )

  • worked, Thank you very much <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Why scores table are not automatized?? i mean we put a "score table" in a game we are working on and the score table do all the rest you know, nothig to code or start thinking to all thoses complicates stuffs... <img src="smileys/smiley5.gif" border="0" align="middle" />

  • because, all the scores from all users, should be stored in a server ... We can not be automatically ....

  • imothep85 we're going to soon start working on an Arcade plugin that will allow you to log high scores without any programming!

    In the mean time if you want a high score system you will have to write some simple server side code like PHP to achieve it.

  • OUAAH great, thanks Tom <img src="smileys/smiley17.gif" border="0" align="middle" /> <img src="smileys/smiley42.gif" border="0" align="middle" />

  • Scirra Developers is the best...

    Once again, the Construct 2 is the best game engine.

    The plugin will help all members to have their hiscore for games. NO PHP programming...

    BRAVO, CONGRATULATIONS <img src="smileys/smiley32.gif" border="0" align="middle" />

  • imothep85 we're going to soon start working on an Arcade plugin that will allow you to log high scores without any programming

    Awesome news! Thank you!

  • ..so how is that plugin coming along?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yeah, im curious too. Would love an easier way to do scores.

    This is simply to confusion for beginners..

  • yeah, im curious too. Would love an easier way to do scores.

    This is simply to confusion for beginners..

    Arcade plugin was released a while ago. Also, there are 3rd party plugins like clay.io that allow you to create online highscore tables pretty easily.

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