Hi,
I am struggling with the following.
I have a table "jobs" that strores booked jobs in columns such as:
$row_rsjob['jid']
$row_rsjob['company']
$row_rsjob['surname']
I have create a Recordset for it rsjob
SELECT *
FROM job
WHERE ( TO_DAYS(B) - TO_DAYS(NOW()) < 7 ) AND (TO_DAYS(B) - TO_DAYS(NOW()) >-1 ) AND job.status='Confirmed'
ORDER BY job.b ASC , job.hours ASC , job.minutes ASC
And of course all was fine, i could display my jobs within the next 7 days with all details and link them to a job detail page etc. All fine.
Except that I needed to have the jobs listed in some kind of more "calendar" looking format, such as:
2005
November
Monday 28 november 2005
Tuesday 29 november 2005
Wednesday 29 november 2005
December
Friday 2 décember 2005
The code below does just that and lines up my booked jobs date in this diary looking way.
<?php $query = "SELECT UNIX_TIMESTAMP(B) AS date FROM job
WHERE (TO_DAYS(B) - TO_DAYS(NOW()) < 7)
AND (TO_DAYS(B) - TO_DAYS(NOW()) > -1)
AND job.status='Confirmed'
ORDER BY job.b ASC, job.hours ASC, job.minutes ASC";
$result = mysql_query($query);
setlocale(LC_TIME, fr_BE);
$indent = ' ';
$table_year = '';
$table_month = '';
while ($line = mysql_fetch_array($result)) {
$date = $line['date'];
$date_year = date('Y', $date);
if ($date_year != $table_year) {
$table_year = $date_year;
$table_month = '';
echo '<br />' . $table_year . '<br />';
}
$date_month = date('F', $date);
if ($date_month != $table_month) {
$table_month = $date_month;
echo $indent . $table_month . '<br />';
}
echo $indent . $indent . strftime('%A %e %B %Y', $date) . '<br />';
echo $row_rsjob['company'];
// Use "%#d" instead of "%e" for Windows machine
} ?>
My only problem is that now it just displays the job dates but no other info.
What I need to get to is:
2005
November
Monday 28 november 2005
Job id: 103
Company: muk ltd
contack name: Mr krish
View job details (make this a link that passes the $jid (jod id number)
Tuesday 29 november 2005
Job id: 104
Company: mlokk ltd
contack name: Mr krisjggh
View job details (make this a link that passes the $jid (jod id number)
Wednesday 29 november 2005
Job id: 105
Company: mhiytrduk ltd
contack name: Mr kddddrish
View job details (make this a link that passes the $jid (jod id number)
and so on.
i cannot understand how i could link my two recorset staments, the one that picks all the columns and the one that just picks my date field ($😎
and how to achieve what i describe.
Can you please help?
Many thanks,
Vinny