I'm getting the "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 'long, ul_lat, ul_long, lr_lat, lr_long, buffer, study_area, from_date, to_dat...' at line 1 )" error.
I've dumped and checked variables. All have values or are NULL. The query table has first value queryid not included insert as it is an autoincrement primary key.
I have another function in this file that inserts in the exact same way, with an autoincrement variable, but all varibles in that table are strings and this one is a mix of int, varchar, decimal, dates. Cannot figure out what it's complaining about!
$stmt = $conn->prepare("select * from query where queryid = :queryid");
$insert = $conn->prepare("insert into query(lat, long, ul_lat, ul_long, lr_lat, lr_long, buffer, study_area, from_date, to_date, ge, wv, qb, ov, ik, email, status, request_date, search_date, inventory, cidr, num_images, delivery_date, wv2, wv3, NCCSmvDate)VALUES(:lat, :long, :ul_lat, :ul_long, :lr_lat, :lr_long, :buffer, :study_area, :from_date, :to_date, :ge, :wv, :qb, :ov, :ik, :email, :status, :request_date, :search_date, :inventory, :cidr, :num_images, :delivery_date, :wv2, :wv3, :NCCSmvDate)
");
//Begin Transaction
$conn->beginTransaction();
try {
$res = $stmt->execute(array( ':queryid'=>$queryid));
if (!$res) {
throw new Exception('<p>Could not execute query. </p>');
}
if ($stmt->rowCount()>0){
throw new Exception('<p>That queryID is taken.</p>');
}
$res = $insert->execute(array(
':lat'=>$lat,
':long'=>$long,
':ul_lat'=>$ul_lat,
':ul_long'=>$ul_long,
':lr_lat'=>$lr_lat,
':lr_long'=>$lr_long,
':buffer'=>trim($buffer),
':study_area'=>trim($study_area),
':from_date'=>$from_date,
':to_date'=>$to_date,
':ge'=>trim($ge),
':wv'=>trim($wv),
':qb'=>trim($qb),
':ov'=>trim($ov),
':ik'=>trim($ik),
':email'=>trim($email),
':status'=>trim($status),
':request_date'=>$request_date,
':search_date'=>$search_date,
':inventory'=>trim($inventory),
':cidr'=>trim($cidr),
':num_images'=>$num_images,
':delivery_date'=>$delivery_date,
':wv2'=>trim($wv2),
':wv3'=>trim($wv3),
':NCCSmvDate'=>$NCCSmvDate
));