So guys, I got an error message :
Error : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' '')' at line 1
From this codes, Whenever I click Add button
todo.php
<?php
include '../database/database.php';
session_start();
$user_id = $_SESSION['user_id'];
$querydisplay = "SELECT * FROM todo WHERE user_id=$user_id";
$result = mysqli_query($conn, $querydisplay);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>To Do List</title>
    <!-- Bootstrap core CSS -->
    <link href="../assets/css/bootstrap.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="../assets/css/custom.css" rel="stylesheet">
  </head>
  <body>
    <div class="container">
      <div class="header clearfix">
        <nav>
          <ul class="nav nav-pills pull-right">
            <li role="presentation" class="active"><a href="#">Home</a></li>
            <li role="presentation"><a href="#">About</a></li>
            <li role="presentation"><a href="#">Contact</a></li>
          </ul>
        </nav>
        <h3 class="text-muted">To Do List <?php echo $_SESSION['name'];?></h3>
      </div>
      <div class="panel panel-default">
        <div class="panel-heading"></div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-2"></div>
                <div class="col-md-8">
                    <ul class="list-group text-left">
                        <?php while($data=mysqli_fetch_array($result)) :?>
                            <?php if($data['done'] == 0) : ?>
                                <li class="list-group-item"><span class="task_list"><?php echo $data['task'] ?></span><a href="../models/done_process.php?id=<?php echo $data['list_id']?>"><span class="label label-default">Mark As Done</span></a></li>
                            <?php else : ?>
                                <li class="list-group-item"><span class="task_list"><strike><?php echo $data['task'] ?></strike></span><a href="../models/delete_process.php?id=<?php echo $data['list_id']?>"><span class="label label-danger">Delete</span></a></li>
                            <?php endif; ?>
                        <?php endwhile; ?>
                    </ul>
                    <form class="form-horizontal" method="POST" action="../models/newtask_process.php">
                        <div class="form-group">
                            <div class="col-sm-12">
                                <input name="newtask" type="text" class="form-control" placeholder="Enter New Task">
                            </div>
                        </div>                       
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button name="submit" type="submit" class="btn btn-sm btn-primary">Add</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="col-md-2"></div>
            </div>
        </div>
        </div>
      <footer class="footer text-center">
        <p>© Company 2017</p>
      </footer>
    </div> <!-- /container -->
  </body>
</html>
newtask_process.php
<?php
include '../database/database.php';
session_start();
if(isset($_POST['submit']))
    $user_id = $_SESSION['user_id'];
    $task = mysqli_real_escape_string($conn, $_POST['newtask']);
if(!isset($user_id) || $user_id = "" || !isset($task) || $task = "")
{
    echo '<script language="javascript">alert("You Write an Empty Task. Process Failed.");
              document.location="../views/todo.php";</script>';
}
else
{
    $queryinsert = "INSERT INTO todo (user_id, task) VALUES ($user_id, '$task')";
    if(mysqli_query($conn, $queryinsert))
    {
        header("Location: ../view/todo.php");
        exit();
    }
    else
    {
        die ('Error : ' .mysqli_error($conn));
    }
}
mysqli_close($conn);
?> 
Please help me debug this insert query or something like that.
I haven't even move to the update or delete query yet.
I already look the similiar question like this, and I already try them, but no success, 
Maybe there is something I miss
I know this is not safe way to execuse query (I dont use PDO or something like that).
But I'm just trying to get a hang of it, maybe later I will move to the PDO and OOP concept.
 
     
     
    