Thanks for having me on Stackoverflow im really enjoying my stay. I have decided to use 000webhost as my database. I'm a PHP Beginner. I put in my url followed by /Register.php which is the file of my PHP file so that when a user registers it's uploaded to the database. It has said 'Connection successful' in the past with error lines which I've grown to fix. One I can not fix right now is below:
Here is my php file:
<?php
$servername = 'localhost';
$username = 'xxx';
$password = 'xxx';
$database = 'xxx';
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
$query ="INSERT INTO user VALUES (?, ?, ?, ?, ?)";
$statement = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($statement, "issis" ,$id, $name, $username, $age, $password);
if(isset($_POST['name'])){
$name = $_POST['name'];
}
if(isset($_POST['username'])){
$username = $_POST['username'];
$username = $_POST["username"];
$age = $_POST["age"];
$password = $_POST["password"];
mysqli_stmt_execute($statement);
$response = array();
$response["success"] = true;
print(json_encode($response));
printf("%d Row embed.\n", mysqli_stmt_affected_rows($statement));
mysqli_stmt_close($statement);
?>
HOWEVER
I receive this line of error when viewing it in Google Chrome
Parse error: syntax error, unexpected end of file in /storage/ssd1/298/7395298/public_html/Register.php on line 38
And
This when I view it in 000webhost
Syntax Error, Unexpected $EOF
I'm hopefully under the right impression that once that problem has been rectified the information will be sent to my database successfully.