Gravi's Recent Forum Activity

  • im trying to set values once time only

    but when i switch layout to another , trigger once start again

    how can i stop

    i want to set only once time when open game

    suggest me correct events

  • If i have panel added image points 2

    image point 1 and 2

    so i need to compare

    if panel image point 2

    is overlapping window > panel image point 2 set to position window

  • You do not have permission to view this post

  • thanks for suggesting

    hey Bro,

    i set image in loading logo

    But its looking circle

    but my image is in square

    Also i check other options like

    Splash Screen and foreground background

    but comes in a circle

  • i make a layout as name Loader layout

    and added image to show as loading screen

    and set properties as shown in image

    But When project launch , app shown 1st loading icon after that app gone to loader layout

    so i want to make

    when app launch show loader layout not icon

    how to make it guide me....

    Tagged:

  • Using browser addon you can check internet connectivity

  • Is this correct

    i tried but

    return value 0

    Tagged:

  • do you have c3p file ?

  • you won bro

    and i got it...

  • i changed the php script

    now no any error and browser console and data submitted successfully from c3 project

    but not reflecting in sql table

    table name - users

    name and score

    <?php

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

    header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");

    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");

    // Database connection details

    $db = "id22078763_store"; // Your database name

    $dbu = "id22078763_db"; // Your database username

    $dbp = "Db@user5"; // Your database users' password

    $host = "localhost"; // MySQL server - usually localhost

    // Connect to the database

    $dblink = mysqli_connect($host, $dbu, $dbp, $db);

    // Check the connection

    if (!$dblink) {

    die("Connection failed: " . mysqli_connect_error());

    }

    if (isset($_GET['name']) && isset($_GET['score'])) {

    // Lightly sanitize the GET parameters

    $name = mysqli_real_escape_string($dblink, $_GET['name']);

    $score = mysqli_real_escape_string($dblink, $_GET['score']);

    // Insert the score into the database

    $sql = "INSERT INTO `users` (`name`, `score`) VALUES ('$name', '$score')";

    if (mysqli_query($dblink, $sql)) {

    echo 'Your score was saved. Congrats!';

    } else {

    // Log or echo the error message if the query fails

    echo 'There was a problem saving your score. Please try again later. Error: ' . mysqli_error($dblink);

    }

    } else {

    echo 'Your name or score was not passed in the request. Make sure you add ?name=NAME_HERE&score=1337 to the URL.';

    }

    // Close the MySQL connection

    mysqli_close($dblink);

    ?>

  • <?php

    // Allow from any origin

    if (isset($_SERVER['HTTP_ORIGIN'])) {

    // Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one you want to allow, and if so:

    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");

    header('Access-Control-Allow-Credentials: true');

    header('Access-Control-Max-Age: 86400'); // cache for 1 day

    }

    // Access-Control headers are received during OPTIONS requests

    if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {

    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))

    header("Access-Control-Allow-Methods: GET, POST, OPTIONS");

    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))

    header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");

    exit(0);

    }

    // Database connection details

    $servername = "localhost";

    $username = "id22078763_db";

    $password = "Db@user5";

    $dbname = "id22078763_store";

    // Create connection

    $conn = new mysqli($servername, $username, $password, $dbname);

    // Check connection

    if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

    }

    // Check if the request method is POST

    if ($_SERVER["REQUEST_METHOD"] == "POST") {

    // Get the score and player name from the POST data

    $score = $_POST['score'];

    $playerName = $_POST['playerName'];

    // Check if the player exists

    $sql = "SELECT id FROM users WHERE name = ?";

    $stmt = $conn->prepare($sql);

    $stmt->bind_param("s", $playerName);

    $stmt->execute();

    $result = $stmt->get_result();

    if ($result->num_rows > 0) {

    // Player exists, update their score

    $updateSql = "UPDATE users SET score = ? WHERE name = ?";

    $updateStmt = $conn->prepare($updateSql);

    $updateStmt->bind_param("is", $score, $playerName);

    $updateStmt->execute();

    echo "Score updated successfully";

    } else {

    // Player doesn't exist, insert a new record

    $insertSql = "INSERT INTO users (name, score) VALUES (?, ?)";

    $insertStmt = $conn->prepare($insertSql);

    $insertStmt->bind_param("si", $playerName, $score);

    $insertStmt->execute();

    echo "New record created successfully";

    }

    $stmt->close();

    }

    // Close the database connection

    $conn->close();

    ?>

    On Sql I have

    users table

    in this table

    name and score

    and im trying to post score

    getting error

    i dont know what's going wrong

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i face as same

Gravi's avatar

Gravi

Member since 27 Oct, 2020

Twitter
Gravi has 1 followers

Trophy Case

  • 4-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies