function populate_variables($db, $latitude, $longitude) { $select_api_results = select_api_results($latitude, $longitude); if ($result = $db->query($select_api_results)) { $json_results = array(); $c = 0; while ($obj = $result->fetch_object()) { $json_results[$c] = $obj; $fb_name[$c] = $obj->fb_name; $fb_lat[$c] = $obj->fb_lat; $fb_lng[$c] = $obj->fb_lng; $fb_street[$c] = $obj->fb_street; $fb_city[$c] = $obj->fb_city; $fb_state[$c] = $obj->fb_state; $fb_zip[$c] = $obj->fb_zip; $fb_talking_about[$c] = number_format($obj->fb_talking_about, 0, null, ','); $fb_likes[$c] = number_format($obj->fb_likes, 0, null, ','); $fb_were_here[$c] = number_format($obj->fb_were_here, 0, null, ','); $fb_date[$c] = $obj->fb_date; $fb_description[$c] = $obj->fb_description; $fb_web[$c] = $obj->fb_web; $fb_web_parse[$c] = parse_url($obj->fb_web, PHP_URL_HOST); $fb_cover[$c] = $obj->fb_cover; $fb_about[$c] = $obj->fb_about; $fb_culinary_team[$c] = $obj->fb_culinary_team; $heatery_score[$c] = $obj->heatery_score; $name = './data/results.json'; $fp = fopen($name, 'w'); fwrite($fp, json_encode($json_results)); fclose($fp); ++$c; } $result->close(); } $db->close(); }
function populate_variables($db, $latitude, $longitude) { $select_api_results = select_api_results($latitude, $longitude); if ($result = $db->query($select_api_results)) { $json_results = array(); $c = 0; while ($obj = $result->fetch_object()) { $json_results[$c] = $obj; $fs_name[$c] = stripslashes($obj->name); $fs_phone[$c] = $obj->phone; $fs_checkins[$c] = number_format($obj->fs_checkins, 0, null, ','); $fs_users[$c] = number_format($obj->fs_users, 0, null, ','); $fs_tips[$c] = number_format($obj->fs_tips, 0, null, ','); $hours_status[$c] = $obj->hours_status; $name = 'data/results.json'; $fp = fopen($name, 'w'); fwrite($fp, json_encode($json_results)); fclose($fp); ++$c; } $result->close(); } $db->close(); }