$querry=sprintf("SELECT * FROM %s ORDER BY t_date ASC;",$_SESSION['userName']);
}
else{
$querry=sprintf("SELECT * FROM %s WHERE task_completion = '%s' ORDER BY t_date ASC;",$_SESSION['userName'],$comp);
}
$pdo_st=$pdo->query($querry);
$pdo_st->setFetchMode(PDO::FETCH_ASSOC);
while($row=$pdo_st->fetch())// Takes 1 row of the data table, stores into an assoc array called row, elements of each row can be called by column name.
...
...
@@ -35,9 +41,14 @@ function all($pdo, &$taskArr) {
}
}
functiontoday($pdo,&$taskArr){
functiontoday($pdo,&$taskArr,$comp){
$date=date('Y-m-d');
if(is_null($comp)){
$querry=sprintf("SELECT * FROM %s WHERE t_date >= '%s' ORDER BY t_date ASC;",$_SESSION['userName'],$date);
}
else{
$querry=sprintf("SELECT * FROM %s WHERE t_date >= '%s' AND task_completion = '%s' ORDER BY t_date ASC;",$_SESSION['userName'],$date,$comp);
}
$pdo_st=$pdo->query($querry);
$pdo_st->setFetchMode(PDO::FETCH_ASSOC);
while($row=$pdo_st->fetch())// Takes 1 row of the data table, stores into an assoc array called row, elements of each row can be called by column name.
...
...
@@ -47,8 +58,12 @@ function today($pdo, &$taskArr) {
}
}
functioncustom($pdo,&$taskArr,$inputDate){
functioncustom($pdo,&$taskArr,$inputDate,$comp){
if(is_null($comp)){
$querry=sprintf("SELECT * FROM %s WHERE t_date >= '%s' ORDER BY t_date ASC;",$_SESSION['userName'],$inputDate);
}else{
$querry=sprintf("SELECT * FROM %s WHERE t_date >= '%s' AND task_completion = '%s' ORDER BY t_date ASC;",$_SESSION['userName'],$inputDate,$comp);
}
$pdo_st=$pdo->query($querry);
$pdo_st->setFetchMode(PDO::FETCH_ASSOC);
while($row=$pdo_st->fetch())// Takes 1 row of the data table, stores into an assoc array called row, elements of each row can be called by column name.
...
...
@@ -61,19 +76,19 @@ function custom($pdo, &$taskArr, $inputDate) {