Skip to content

Instantly share code, notes, and snippets.

@nohe427
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save nohe427/ab2fa65716a0e9d20ade to your computer and use it in GitHub Desktop.

Select an option

Save nohe427/ab2fa65716a0e9d20ade to your computer and use it in GitHub Desktop.
Add Json Data to
<?php
ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);
//Attempt to Connect
$connection = @mysql_connect ('localhost', 'root', 'nohe');
@mysql_select_db("Noah", $connection);
//include("./connect.php"); //Connect to the database.
$client_data = file_get_contents("php://input");
$jsonArray = json_decode($client_data, true);
$query = "INSERT INTO `testTable` (`c1`, `c2`, `c3`, `c4`) VALUES ('".$jsonArray."', '".$_GET['c2']."', '".$_GET['c3']."', '".$_GET['c4']."')"; //Add them to the db.
//$query = mysql_query("INSERT INTO `SESSIONS` (`TIMEIN`, `USER`, `TIMEOUT`, `SITE`) VALUES ('".$_GET["timein"]."', '".$_GET['userid']."', '".$_GET['timeout']."', '".$_GET['siteid']."')"); //Add them to the db.
$sqlresult = mysql_query($query, $connection);
echo $query;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment