Skip to content

Instantly share code, notes, and snippets.

@amin007
Created March 10, 2015 15:01
Show Gist options
  • Save amin007/5dc835496fb57d121184 to your computer and use it in GitHub Desktop.
Save amin007/5dc835496fb57d121184 to your computer and use it in GitHub Desktop.
<?php
// tukar jadi data json dari main website
##############################################
include "db_buka.php";// buka pangkalan data #
##############################################
$mysqli = new mysqli($myServer, $myUser, $myPass, $myDB);
$myArray = array();
if ($result = $mysqli->query('SELECT `id`, `bahagian`, `nama`, `link`, `target` FROM link'))
{
while($row = $result->fetch_array(MYSQL_ASSOC))
{
$myArray[] = $row;
}
echo json_encode($myArray);
}
$result->close();
$mysqli->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment