function php2js_sqlresult($phpsql) { // Printing results $rows = array(); while ($line = mysql_fetch_assoc($phpsql)) { $rows[] = $line; } mysql_free_result($phpsql); return php2js_array($rows); }
function json_encode_result($phpdata) { if (!$phpdata) { return "[]"; } if (is_array($phpdata)) { return php2js_array($phpdata); } else { return php2js_object($phpdata); } }
function json_encode_result($phpdata) { if (gettype($phpdata) == "resource") { return php2js_sqlresult($phpdata); } else { if (is_array($phpdata)) { return php2js_array($phpdata); } else { return php2js_object($phpdata); } } }