php - Call to a member function query() on null -


i have weird problem php file adding database. installed php7 on server (when php 5.6 installed works well) , getting error:

php message: php fatal error: uncaught error: call member function query() on null in /srv/patch/newdb.php:26

newdb file.

<?php session_start(); require_once 'connectdb.php';  $data = json_decode(file_get_contents("php://input"));  $username = mysqli_real_escape_string($connect, $data->username); $task = mysqli_real_escape_string($connect, $data->task); $dept = mysqli_real_escape_string($connect, $data->dept); $state = mysqli_real_escape_string($connect, $data->state); $task_start = mysqli_real_escape_string($connect, $data->task_start); $task_end = mysqli_real_escape_string($connect, $data->task_end); $login = mysqli_real_escape_string($connect, $data->login); $deadline = mysqli_real_escape_string($connect, $data->deadline); $priority = mysqli_real_escape_string($connect, $data->priority);  if($_session['type']=='admin') {        $query = "insert tasks_main (username,task,dept,status,task_start,task_end,deadline,task_time,priority) values ('$login','$task','$dept','$state','$task_start','$task_end','$deadline','$task_time','$priority')";           }else {     $query = "insert tasks_main (username,task,dept,status,task_start,task_end,deadline,task_time,priority) values ('$username','$task','$dept','$state','$task_start','$task_end','$deadline','$task_time','$priority')"; }  mysqli_query($connect, $query);  echo true; mysqli_close($connect); ?> 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -