0

I'm trying to get a longtext variable from my database table, and put the result as a json variable, every time I have a blank page without giving me any errors. Here is my code:

<?php
require_once 'include/DB_Functions.php';
$db = new DB_Functions();

// json response array
$response = array("error" => FALSE);

if (isset($_GET['email']) && isset($_GET['password'])) {

// receiving the post params
$email = $_GET['email'];
$password = $_GET['password'];

// get the user by email and password
$user = $db->getUserByEmailAndPassword($email, $password);

if ($user != false) {
    // use is found
    $response["error"] = FALSE;
    $response["user"]["firstname"] = $user["firstname"];
    $response["user"]["lastname"] = $user["lastname"];
    $response["user"]["email"] = $user["email"];
    $response["user"]["created_at"] = $user["created_at"];
    $response["user"]["description"] = $user["description"];
    echo json_encode($response);
} else {
    // user is not found with the credentials
    $response["error"] = TRUE;
    $response["error_msg"] = "Login credentials are wrong. Please try again!";
    echo json_encode($response);
}
} else {
// required post params is missing
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters email or password is missing!";
echo json_encode($response);
}
?>

My problem is with the "description" row (longtext),

Thank you in advance

JJJ
  • 32,902
  • 20
  • 89
  • 102
Caroline
  • 71
  • 2
  • 6

0 Answers0