Code: Select all
$query = "SELECT * FROM swnb_cards WHERE department = '$department' AND issue_date BETWEEN '$start_date' AND DATE_ADD('$start_date', INTERVAL $interval $unit )";Code: Select all
$sqlOBJ = new mysql ( );
$department = 1;
$start_date = "2009-03-12";
$interval = 7;
$unit = "DAY";
$query = "SELECT * FROM swnb_cards WHERE department = '$department' AND issue_date BETWEEN '$start_date' AND DATE_ADD('$start_date', INTERVAL $interval $unit )";
$sqlOBJ->query ( $query );Code: Select all
function per_department($start_date, $department, $interval, $unit) {
// do query
$query = "SELECT * FROM swnb_cards WHERE department = '$department' AND issue_date BETWEEN '$start_date' AND DATE_ADD('$start_date', INTERVAL $interval $unit )";
$this->sqlOBJ->query($query);My question(s) is: Is there a better way to archive this? what is wrong in the statement that may be preventing it form returning a result when used in a class? Any ideas would be helpful I have spent way too much time on this and need a fix asap, thanks all.