<?php error_reporting(E_ALL); ini_set('display_errors', 1); //$a = print_r(var_dump($GLOBALS),1); //echo htmlspecialchars($a); $servername = "#"; $username = "#"; $password = "#"; $dbname = "#"; // Create connection //$conn = mysqli_connect($servername, $username, $password, $dbname); //echo "Connection Successful : "; // Check connection //if (!$conn) { // die("Connection failed: " . mysqli_connect_error()); //} // Read JSON file //$jsondata = file_get_contents('scripts/AUDIT_DIR/report.json'); //echo "JSON File Read : "; // Convert and Loop //$item = json_decode($jsondata, true); $item = null; echo "JSON File Decoded : "; foreach($item as $arr) { $id = $arr["id"]; $hostname = $arr["hostname"]; $ip = $arr["ip"]; $package = $arr["package"]; $publisher = $arr["publisher"]; $origin = $arr["origin"]; $version = $arr["version"]; $size = $arr["size"]; //$sql = "INSERT INTO testtable(id, hostname, ip, package, publisher, origin, version, size) //VALUES ('10', '$hostname', '$ip', '$package', '$publisher', '$origin', '$version', '$size')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully : "; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } }
You have javascript disabled. You will not be able to edit any code.