Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

sopham / todolist

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • todolist
  • insert.php
Find file
BlameHistoryPermalink
  • sopham's avatar
    comment, delete unnescessary code · 142cce75
    sopham committed 6 years ago
    142cce75
insert.php 566 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php
session_start();

//include database connection data
include_once "dbconnection.php";

//make the query
$query = "INSERT INTO toDoList (task, userID) VALUES (?,?) ";

//prepare empty values as placeholders
$query = $link->prepare($query1);

//bind variables to the prepared query
$query -> bind_param('si', $_POST['task'], $_SESSION['id']);

//execute the query
$query -> execute();

//return the last id task as response
$last_id = mysqli_insert_id($link);
echo $last_id;

//close the statement
$query -> close();

//close the connection
$link -> close();
?>