public function getlast() { $conn=new data_access(); $sql = <<<SQL SELECT bolo_id FROM `wp_flierform` ORDER BY bolo_id DESC LIMIT 1 SQL; return $conn->execute_query($sql); }
public function archive($date1, $date2) { $activeWhere = false; $sql = "UPDATE wp_flierform SET archive = TRUE"; if (strlen($date1) > 0) { $sql .= " WHERE datecreated >= '" . $date1 . "'"; $activeWhere = true; } if (strlen($date2) > 0) { if ($activeWhere == false) { $sql .= " WHERE datecreated <= '" . $date2 . "'"; $activeWhere = true; } else { $sql .= " AND datecreated <= '" . $date2 . "'"; } } $conn = new data_access(); //echo($sql); $flag1 = $conn->execute_query($sql); //Insert to Archive Table $author = get_current_user_id(); $activeWhere = false; $sql = "INSERT INTO bolo_archive SELECT *, '{$author}' AS archive_author, CURRENT_TIMESTAMP() FROM wp_flierform"; if (strlen($date1) > 0) { $sql .= " WHERE datecreated >= '" . $date1 . "'"; $activeWhere = true; } if (strlen($date2) > 0) { if ($activeWhere == false) { $sql .= " WHERE datecreated <= '" . $date2 . "'"; $activeWhere = true; } else { $sql .= " AND datecreated <= '" . $date2 . "'"; } } $conn = new data_access(); //echo($sql); $falg2 = $conn->execute_query($sql); return $flag1 && $flag2; }
public function unarchive($bolo_id){ //mark bolo as archived $conn = new data_access(); $sql = "UPDATE wp_flierform SET archive = FALSE WHERE bolo_id = '" .$bolo_id. "'"; if(!$result = $conn->execute_query($sql)){ die('There was an error running the query [' . $db->error . ']'); } }// end unarchive
/** * This fuction resturns the bolo that's gonna be converted to a pdf */ public function get_bolo(){ $conn=new data_access(); $sql = <<<SQL SELECT * FROM `bolo_pdf` ORDER BY datecreated DESC LIMIT 1 SQL; return $conn->execute_query($sql); }