Example #1
0
function php2js_sqlresult($phpsql)
{
    // Printing results
    $rows = array();
    while ($line = mysql_fetch_assoc($phpsql)) {
        $rows[] = $line;
    }
    mysql_free_result($phpsql);
    return php2js_array($rows);
}
Example #2
0
function json_encode_result($phpdata)
{
    if (!$phpdata) {
        return "[]";
    }
    if (is_array($phpdata)) {
        return php2js_array($phpdata);
    } else {
        return php2js_object($phpdata);
    }
}
Example #3
0
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);
        }
    }
}