Skip to content

Instantly share code, notes, and snippets.

@vishalkurup
vishalkurup / json.php
Last active December 16, 2015 05:09
PHP code to display data from our cities database in JSON format. This is the companion code to my iOS Tutorial on loading data from an external database into a table view on YouTube. Youtube channel: www.youtube.com/vtkurup/
<?php
/***************************************************************
Description: City data in JSON.
Developer: Vishal Kurup
***************************************************************/
$host = "abc12345"; //Your database host server
$db = "abc12345"; //Your database name
$user = "abc12345"; //Your database user
@vishalkurup
vishalkurup / iosjson.sql
Last active April 17, 2016 00:23
SQL code to generate the table and data we will use in our PHP json page. This data will be consumed in our iOS app. This is the companion code to my iOS Tutorial on loading data from an external database into a table view on YouTube. Youtube channel: www.youtube.com/vtkurup/
-- create table
CREATE TABLE cities
(
id INT PRIMARY KEY NOT NULL auto_increment,
cityName VARCHAR(255),
cityState VARCHAR(255),
cityPopulation int,
country VARCHAR(255)
);