SyntaxFix
Write A Post
Hire A Developer
Questions
Tags
I want to convert my result array to JSON format in PHP. Here is my code:
$row = mysql_fetch_array($result)
I want to convert $row to JSON format and pass the JSON data to an jQuery plugin.
$row
This question is related to php json
php
json
$result = mysql_query($query) or die("Data not found."); $rows=array(); while($r=mysql_fetch_assoc($result)) { $rows[]=$r; } header("Content-type:application/json"); echo json_encode($rows);
Source: Stackoverflow.com