-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
when I import my DB From a server to a localServer on my PC using XAMPP then I try to fetch data from DB using JSON Api and Retrofit I found that error
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
My Api.php that is in C:\xampp\htdocs\
<?php
include 'DB.php';
$db = DB::getInstance();
header("Content-Type: application/json;charset=utf-8");
function UserLoginMethod($username , $password , $lat, $long){
global $db;
$sql = "SELECT * FROM users WHERE user_email = ? AND user_password = ?
LIMIT 1";
$user_info = $db->query($sql, [$username, $password]);
CheckIsEmpty($user_info);
//echo $db->getSQL();
echo PrintJSON($user_info[0]);
}
switch (@$_GET['function']) {
case "Login":
UserLoginMethod(@$_GET['user_email'], @$_GET['user_password'], $_GET['user_location_latitude'], $_GET['user_location_longitude']);
break;
}
function CheckIsEmpty($query) {
if (is_null($query)||empty($query)){
die (json_encode(array('error' => 'no items funded.'),JSON_FORCE_OBJECT));
}
}
function PrintJSON($q){
$j = json_encode($q);
if (count($j) > 0 && !is_null($q) )
return $j;
else
die (json_encode(array('error' => 'no items funded.'),JSON_FORCE_OBJECT));
}
function CreateDieError($body){
die (json_encode(array("error" => $body),JSON_FORCE_OBJECT));
}
?>
the current development environment in DB.php that is in C:\xampp\htdocs\
$db_config = [
//current development environment
"env" => "development",
//Localhost
"development" => [
"host" => "127.0.0.1",
"database" => "egydcom_family",
"username" => "root",
"password" => ""
],
//Server
"production" => [
"host" => "127.0.0.1",
"database" => "egydcom_family",
"username" => "root",
"password" => ""
]
];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels