<?php include('includes/config/config.php'); include('includes/functions.php'); include('log_entry.php'); $habit_id = $_POST['habit_id']; $habit = $_POST['habit']; if (!empty($habit_id)) { $in = "update"; $en = " where habit_id = '" . $habit_id . "'"; } else { $in = "insert into "; $em = ''; } $query = $in . " habits set habit = '$habit',modified_by='" . $_SESSION['user_id'] . "'" . $en; error_log($query); if (!$result = @mysqli_query($conn, $query)) { exit(mysqli_error($conn)); }