Basically, from the form that I made I send customer_name and with this code I pull it and save it to the database along with the time. This code keeps giving me this error:
Fatal error: Using $this when not in object context in /home/projectu/public_html/sub/save.php on line 19
Note: 19th line is this one:
$db->query($queryone);
Here is my code:
Whole Save.php
include('db-config.php');
$customer_name = $_POST['customername'];
/* Kaspersky */
$kaspersky_date = strtotime("+11 months").'|'.strtotime("+12 months");
$kaspersky = explode("|", $kaspersky_date);
$kaspersky_temp = "$customer_name got new kaspersky.";
/* PC Picked-UP */
$pickedups_date = strtotime("+1 months");
$pickedups_temp = "$customer_name picked up his computer.";
if(isset($_POST['kaspersky'])) {
$queryone = "INSERT INTO sublist (scheduled_date, customer_name, kaspersky_status, kaspersky_template)
VALUES ($kaspersky[0], $customer_name, YES, $kaspersky_temp)";
$this->query($queryone);
$querytwo = "INSERT INTO sublist (scheduled_date, customer_name, kaspersky_status, kaspersky_template)
VALUES ($kaspersky[1], $customer_name, YES, $kaspersky_temp)";
$this->query($querytwo);
}
if(isset($_POST['pickeduppc'])) {
$query = "INSERT INTO sublist (scheduled_date, customer_name, pcpickup_status, pcpickup_template)
VALUES ($pickedups_date, $customer_name, YES, $pickedups_temp)";
}
You cannot use
$thisin a non object or static method. You should create a new object.