PHP, JSON, and MySQL -



PHP, JSON, and MySQL -

what easiest way retrieve info database, , convert info json string? there kind of helper class? or supposed loop through columns in dataset create json string?

sample code great

you can utilize json_encode function convert native php array or stdclass object it's corresponding json representation:

$result = $db->query('some query'); $set = array(); if($result->num_rows) { while($row = $result->fetch_array()) { $set[] = $row; } } echo json_encode($set);

php mysql json

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -