Esempio n. 1
0
function my_json_encode($result)
{
    // JSON-ify all rows together as one big array
    $ret = json_encode(my_get_rows($result));
    if (json_last_error()) {
        error_log('json_error');
        error_log(json_last_error());
        error_log(json_last_error_msg());
        return json_last_error_msg();
    }
    return $ret;
}
Esempio n. 2
0
\tTbExternalType
WHERE
\tTbIdPerson.id=1 AND
\tTbIdPerson.id=TbWkWorkViewPerson.viewerId AND
\tTbWkWorkViewPerson.viewId=TbWkWorkView.id AND
\tTbWkWorkView.locationId=TbLocation.id AND
\tTbWkWorkView.deviceId=TbDevice.id AND
\tTbWkWorkView.workId=TbWkWork.id AND
\tTbWkWork.typeId=TbWkWorkType.id AND
\tTbWkWorkType.name='video movie' AND
\tTbWkWork.id=TbWkWorkExternal.workId AND
\tTbWkWorkExternal.externalId=TbExternalType.id AND
\tTbExternalType.name='imdb_title_id'
EOT;
/*
 * If you want to only show movies that have dates add the following
 * predicate to the SQL above:
 * TbWkWorkView.endViewDate IS NOT NULL AND
 */
$query_data = sprintf('%s %s %s %s', $sql_select, $sql_frame, $sql_order, $sql_limit);
$query_count = sprintf('%s %s', 'SELECT COUNT(*)', $sql_frame);
# get the data...
$result_obj = my_mysql_query($query_data);
$result_rows = my_get_rows($result_obj);
$total = my_mysql_query_one($query_count);
# form the response
$response = array('total' => $total, 'views' => $result_rows);
# send the response
echo json_encode($response);
# finish up
utils_finish();