/ Published in: PHP
URL: http://pjotor.com
Converts a MySQL result set to a JSON object, and ensures that the data is UTF-8 encoded. Usage: $conv = new mysql2json(); $JSONresult = $conv->getJSON($result);
Depends on an open link to the database.
Expand |
Embed | Plain Text
class mysql2json{ function getJSON($result){ return json_encode($rows); $rows['data'][] = $r; foreach($rows['data'][$i] as $key => $value) $rows['data'][$i][$key] = $this->noReturns( $this->decodeString( $value ) ) ); return json_encode($rows); } function decodeString($s) { return $s; } }
You need to login to post a comment.
