Question: Several issues occur when we upload files on 000Webhost We used 000Webhost to host a database for our advising app project. Project code can be
Several issues occur when we upload files on 000Webhost
We used 000Webhost to host a database for our advising app project. Project code can be found on Github. My partner uploaded two php files on 000Webhost but he got two errors, we are not sure how to solve it. Here're our php codes.
Github codes for Android Studio: https://github.com/swiftandquick/AdvisingApp
Register.php
$con = mysqli_connect("localhost", "id951876_advisingappadmin", "abc12345", "id951876_advisingapp"); if ( !$con ) { die( 'connect error: '.mysqli_connect_error() ); } $username= ( isset($_POST['username']) ) ? $_POST['username'] : ''; $password= ( isset($_POST['password']) ) ? $_POST['password'] : ''; $confirm_password= ( isset($_POST['confirm_password']) ) ? $_POST['confirm_password'] : ''; $name= ( isset($_POST['name']) ) ? $_POST['name'] : ''; $email= ( isset($_POST['email']) ) ? $_POST['email'] : ''; $major= ( isset($_POST['major']) ) ? $_POST['major'] : ''; $starting_year = ( isset($_POST['starting_year']) ) ? $_POST['starting_year'] : ''; $status= ( isset($_POST['status']) ) ? $_POST['status'] : ''; $statement = mysqli_prepare($con, "INSERT INTO user (username, password, confirm_password, name, email, major, starting_year, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); mysqli_stmt_bind_param($statement, "ssssssis", $username, $password, $confirm_password, $name, $email, $major, $starting_year, $status); mysqli_stmt_execute($statement); $response = array(); $response["success"] = true; echo json_encode($response); ?>
Errors in Register.php:
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /storage/h4/876/951876/public_html/Register.php on line 19
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /storage/h4/876/951876/public_html/Register.php on line 20 {"success":true}
Login.php
$con = mysqli_connect("localhost", "id951876_advisingappadmin", "cjay777i7", "id951876_advisingapp"); $username= ( isset($_POST['username']) ) ? $_POST['username'] : ''; $password= ( isset($_POST['password']) ) ? $_POST['password'] : ''; $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password = ?"); mysqli_stmt_bind_param($statement, "ss", $username, $password); mysqli_stmt_execute($statement); mysqli_stmt_store_result($statement); mysqli_stmt_bind_result($statement, $user_id, $username, $password, $confirm_password, $name, $email, $major, $starting_year, $status); $response = array(); $response["success"] = false; while(mysqli_stmt_fetch($statement)){ $response["success"] = true; $response["username"] = $username; $response["password"] = $password; $response["confirm_password"] = $confirm_password; $response["name"] = $name; $response["email"] = $email; $response["major"] = $major; $response["starting_year"] = $starting_year; $response["status"] = $status; } echo json_encode($response); ?>
Login.php errors:
Warning: mysqli_connect(): (HY000/1045): ProxySQL Error: Access denied for user 'id951876_advisingappadmin'@'2a02:4780:bad:f00d::7' (using password: YES) in /storage/h4/876/951876/public_html/Login.php on line 2
Warning: mysqli_prepare() expects parameter 1 to be mysqli, boolean given in /storage/h4/876/951876/public_html/Login.php on line 7
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, null given in /storage/h4/876/951876/public_html/Login.php on line 8
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given in /storage/h4/876/951876/public_html/Login.php on line 9
Warning: mysqli_stmt_store_result() expects parameter 1 to be mysqli_stmt, null given in /storage/h4/876/951876/public_html/Login.php on line 11
Warning: mysqli_stmt_bind_result() expects parameter 1 to be mysqli_stmt, null given in /storage/h4/876/951876/public_html/Login.php on line 12
Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, null given in /storage/h4/876/951876/public_html/Login.php on line 17 {"success":false}
Anyone care to help out?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
