So essentially i'm following a youtube tutorial and playing around with android studio for the first time.
I am having problems connecting with the database and keep getting the response server error.
I've tried checking the php code on a number of website and they keep saying the code is fine.
Any suggestions?
Register Code:
require_once "connect.php";
if(!$con){
echo "Connecting failed";
}else{
if($_SERVER['HTTP_USER_AGENT'] == "MyTestApp"){
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])){
$name = $_POST['name'];
$email = $_POST ['email'];
$password = md5($_POST['password']);
echo $name;
}
else{
echo "missing fields required";
}
else{
echo "Improper request method";
}
else{
echo "invalid platform";
}
}
?>
Connection Code:
<?php
require_once "constants.php";
$con = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if($con){
echo "Database connection failed";
}else{
echo "Connected!!!";
}
?>
Constants code:
<?php
define ( 'DB_HOST', 'localhost');
define('DB_USER', 'id1950281_patrickmcmu11an');
define( 'DB_PASSWORD', 'jordan123');
define('DB_NAME', 'id1950281_penumbralogin');
?>