Encode Mysql Results to JSON

The title says it all: mysql_set_charset(‘utf8’, $database_connection); // charset $sqlStr = “SELECT * FROM yourtable;”; //provide the query $result = mysql_query ($sqlStr, $database_connection) or die ($sqlStr); // get the results $rows = array(); // create the array if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { // populate array with results $rows[] = $row; } } …

Encode Mysql Results to JSON Read More »