<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');
header("Content-Type: application/json; charset=UTF-8");
include("global.php");
$conn = new mysqli(server, dbuser, dbpw, db);
$user = $_GET['user'];
//$customer = $_GET['customer'];
$querystring = "";
$querystring = "SELECT email, password, firstname, lastname from user ";
$result = $conn->query($querystring);
$outp = "[";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$outp .= '{"email":"' . $rs["email"] . '",';
$outp .= '"password":"' . $rs["password"] . '",';
$outp .= '"firstname":"' . $rs["firstname"] . '",';
$outp .= '"lastname":"' . $rs["lastname"]. '"}';
}
$outp .="]";
$conn->close();
echo($outp);
?>
This is the PHP code in the database and need to use get method. the error shows undefined index : $user = $_GET['user'];
when I run it shows this error. How to fix it?