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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -