Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/json/
File Upload :
Current File : /home/dent/public_html/json/sql_to_json.txt

<?php
$host = "webdev.iyaserver.com";
$userid = "[youruserid]";
$userpw = "[yourpw]";
$db = "[database name]";

// include '../pdloginvariables.php';

$mysql = new mysqli(
    $host,
    $userid,
    $userpw,
    $db
);

$mysql->set_charset("utf8");

if($mysql->connect_errno) {
    echo "db connection error : " . $mysql->connect_error;
    exit();
}

if(empty($sql)) {
    $sql = 		"SELECT * FROM movieView where rating='PG' ORDER BY title LIMIT 50";
}

$results = $mysql->query($sql);

if(!$results) {
    echo "SQL error: ". $mysql->error;
    exit();
}

$json_array = array();

while($currentrow = $results->fetch_assoc()) {
    $json_array[] = $currentrow;
}

/*
echo "<pre>";
print_r($json_array);
echo "</pre>";
*/

 $json2 = json_encode($json_array);

// echo "json error: " . json_last_error_msg() . "<hr>";

echo $json2;