Connor Bishop Connor Bishop - 3 months ago 5x
JSON Question

Echoing JSON Data in php

Im trying to echo some JSON Data. The problem is the data contains variables but my code isn't putting the variables into the string.
Heres my code:

$status = $row['Status'];
$priority = $row['Priority'];
echo '{"status":"$status","priority":"$priority"}' ;

this php is echoing


when I need to echo


for example. How can I fix this?


Just use json_encode function

echo json_encode($row);