i have a validation checker that checks the database to see if the "email and username" is being used and if so then echo the email and username as "false". And if its not in the database then echo to "true". I am returning the results of the users email and username being in the sql sever. So i want to append "$json1 or $json2" to the "$first or $second" like this
{"Email":false, "Username":true};
PHP Code:
<?php
if(isset($_GET['submit'])){
//Connect to database
$link = mysqli_connect("localhost", "root", "");
mysqli_select_db($link, "magicsever");
if(mysqli_connect_error()){
die ("Database connection error");
}
//Find the email in the database
$query = "SELECT * FROM app_signup WHERE email = '".mysqli_real_escape_string($link, $_GET['email'])."'";
$query2 = "SELECT * FROM app_signup WHERE username = '".mysqli_real_escape_string($link, $_GET['username'])."'";
$result = mysqli_query($link, $query);
$result2 = mysqli_query($link, $query2);
$email_checker1 = json_encode(array("Email"=>false));
$email_checker2 = json_encode(array("Email"=>true));
$username_checker1 = json_encode(array("Username"=>false));
$username_checker2 = json_encode(array("Username"=>true));
if(mysqli_num_rows($result)>0){
echo $email_checker1;
}
}
?>