Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Last active March 27, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/f32eb297f2f0a8ab573a2294d249e4db to your computer and use it in GitHub Desktop.
Save itswadesh/f32eb297f2f0a8ab573a2294d249e4db to your computer and use it in GitHub Desktop.
<?php
require_once '../includes/db.php'; // The mysql database connection script
if(isset($_GET['task'])){
$task = $_GET['task'];
$status = "0";
$created = time();
$query="INSERT INTO tasks(task,status,created_at) VALUES ('$task', '$status', '$created')";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$result = $mysqli->affected_rows;
echo $json_response = json_encode($result);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment