Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = mysql_connect("localhost","nav","Austin1997$$#@");
- if (!$db) {
- die('Could not connect to db: ' . mysql_error());
- }
- //Select the Database
- mysql_select_db("testing_nav",$db);
- //Replace * in the query with the column names.
- $result = mysql_query("select * from testingtable", $db);
- //Create an array
- $json_response = array();
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
- $row_array['test'] = $row['test'];
- $row_array['test2'] = $row['test2'];
- $row_array['test3'] = $row['test3'];
- array_push($json_response,$row_array);
- }
- echo json_encode($json_response);
- //Close the database connection
- fclose($db);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement