Hi I am currently setting up my SQL for my leaderboard. I have been able to configure setup mysql to check for existing record when a new user tries to create a new username.
Manually testing it, I am able to create a new user and also when I try to create another user with same name, it echos the message as expected on the browser.
The challenge I have now is with Construct 3, I am able to create a new user but when I try to create same user, on SQL side nothing changes but on Construct 3 side, it still thinks it went OK.
How can I get Construct 3 to get the echo message from mysql so it knows there was an error?
if (mysqli_num_rows($res_u) > 0) {
$name_error = "Sorry... username already taken";
echo 'Sorry... username already taken';
}else{
$sql = "INSERT INTO $db_name.$db_table (name, score)
VALUES ('$name','$score')";
$results = mysqli_query($con, $sql);
echo 'Your account has been created!';
}