Hi so I have a database set up that looks like this https://gyazo.com/240fce43cfcf45f123d64b76acc4093f , however, I don't know how to interact with the score element. To use the ID, Name etc. I followed a youtube tutorial by TechAcademy, where she uses PHP to interact with the database. In the java file of my android studio project, when a button is clicked and certain conditions are met, a counter increments and the activity is restarted, however I want this counter to be sent straight to my database so the users score increments (Example is user clicks the button and the conditions are met, a 1 will be displayed in the database). My php files are as follows for the User, Name etc if they're any help.
Register.php
<?php
$con = mysqli_connect("your_mysql_hostname" , "your_username" , "your_password" , "your_database_name");
$name = $_POST["Name"];
$email = $_POST["Email"];
$username = $_POST["Username"];
$password = $_POST["Password"];
$insertquery = mysqli_prepare($con , "INSERT INTO contacts ( Name ,Email,Username,Password) VALUES (?,?,?,?)");
mysqli_stmt_bind_param($insertquery , "ssss" , $name , $email , $username , $password);
mysqli_stmt_execute($insertquery);
mysqli_stmt_close($insertquery);
mysqli_close($con);
?>
Fetch User Data.PHP
<?php
$con = mysqli_connect("your_mysql_hostname" , "your_username" , "your_password" , "your_database_name");
$password = $_POST["Password"];
$username = $_POST["Username"];
$selectquery = mysqli_prepare($con , "SELECT * FROM contacts WHERE Username = ? AND Password = ?");
mysqli_stmt_bind_param($selectquery , "ss" , $username , $password);
mysqli_stmt_execute($selectquery);
mysqli_stmt_store_result($selectquery);
mysqli_stmt_bind_result($selectquery , $ID , $name , $email,$username , $password);
$user = array();
while(mysqli_stmt_fetch($selectquery))
{
$user[name] = $name;
$user[email] = $email;
$user[username] = $username;
$user[password] = $password;
}
echo json_encode($user);
mysqli_stmt_close($selectquery);
mysqli_close($con);
?>