Could you please tell me what is wrong with this function. Found it in the video: https://www.youtube.com/watch?v=871_PMieyxI (1:24)
I'm getting the error: Parse error: syntax error, unexpected ''{"status" : "success"}'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in C:\xampp\htdocs\myproject\application\controllers\usercontroller.php on line 26
Line 26 is this line: echo $result '{"status" : "success"}';
public function add()
{
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$name = $request->name;
$city = $request->city;
$id = $this->user_model->AddUser($name,$city);
if($id)
{
echo $result '{"status" : "success"}';
} else {
echo $result '{"status" : "failure"}';
}
}