I recently posted, but the discussion went so far over my head I stayed out of it. 
I'm just a newbie, currently taking a course. I've run into a problem that I just can't seem to solve, I don't understand why it won't work and I was hoping someone would be able to help.
Basically I have a database capturing entered tasks and I want to display them on an xtpl created page.
Here's the code. I assume it's not the prettiest, but I'm only concerned with getting it working right now, so if you see any obvious problems please let me know.
Here's the loop to display the tasks:
$getTasks = new task();
$getTasks->getTaskList('I', 'DESC');
$i = 0;
while ($aryRowI = $getTasks->getNextTask()) {
$incompleteTasks = array ('ROWNUMBER'=> ++$i,
'USER'=>$aryRowI['FirstName'] . ' ' . $aryRowI['LastName'],
'TASK'=>$aryRowI['TaskText'],
'TIMEDATE'=>$aryRowI['DateTimeStamp'],
'PRIORITY'=>$aryRowI['Priority'],
'DUEDATE'=>$aryRowI['DueDate']
);
$xtpl->assign('INCOMPLETE', $incompleteTasks);
}
These are the two methods within the task class that are relevant:
public function getTaskList($strStatus, $strOrder)
{
if (!$this->taskListDB) $this->taskListDB = new DB(DATABASE);
$strSqlQuery = 'SELECT tasks.ID, FirstName, LastName, UserID, DateTimeStamp, DueDate, Priority, TaskText, Completed
FROM tasks
JOIN users
ON tasks.UserID = users.ID';
$strSqlQuery = $strSqlQuery . ($strStatus == 'C' ? ' WHERE Completed ' : '');
$strSqlQuery .= $strStatus == 'I' ? ' WHERE NOT Completed ' : '';
$strSqlQuery .= " ORDER BY DateTimeStamp $strOrder ";
$this->taskListDB->execQuery($strSqlQuery);
}
public function getNextTask()
{
$this->aryTask = $this->taskListDB->fetchRow();
return $this->aryTask;
}
public function getTask()
{
return $this->aryTask;
}
Running this I get one row displayed. It appears to be just a random row too. Any help would be much appreciated, it's driving me nuts. Thank you!
I'm just a newbie, currently taking a course. I've run into a problem that I just can't seem to solve, I don't understand why it won't work and I was hoping someone would be able to help.
Basically I have a database capturing entered tasks and I want to display them on an xtpl created page.
Here's the code. I assume it's not the prettiest, but I'm only concerned with getting it working right now, so if you see any obvious problems please let me know.
Here's the loop to display the tasks:
$getTasks = new task();
$getTasks->getTaskList('I', 'DESC');
$i = 0;
while ($aryRowI = $getTasks->getNextTask()) {
$incompleteTasks = array ('ROWNUMBER'=> ++$i,
'USER'=>$aryRowI['FirstName'] . ' ' . $aryRowI['LastName'],
'TASK'=>$aryRowI['TaskText'],
'TIMEDATE'=>$aryRowI['DateTimeStamp'],
'PRIORITY'=>$aryRowI['Priority'],
'DUEDATE'=>$aryRowI['DueDate']
);
$xtpl->assign('INCOMPLETE', $incompleteTasks);
}
These are the two methods within the task class that are relevant:
public function getTaskList($strStatus, $strOrder)
{
if (!$this->taskListDB) $this->taskListDB = new DB(DATABASE);
$strSqlQuery = 'SELECT tasks.ID, FirstName, LastName, UserID, DateTimeStamp, DueDate, Priority, TaskText, Completed
FROM tasks
JOIN users
ON tasks.UserID = users.ID';
$strSqlQuery = $strSqlQuery . ($strStatus == 'C' ? ' WHERE Completed ' : '');
$strSqlQuery .= $strStatus == 'I' ? ' WHERE NOT Completed ' : '';
$strSqlQuery .= " ORDER BY DateTimeStamp $strOrder ";
$this->taskListDB->execQuery($strSqlQuery);
}
public function getNextTask()
{
$this->aryTask = $this->taskListDB->fetchRow();
return $this->aryTask;
}
public function getTask()
{
return $this->aryTask;
}
Running this I get one row displayed. It appears to be just a random row too. Any help would be much appreciated, it's driving me nuts. Thank you!