MS Access data into a html table

Posted on 16th Feb 2014 by admin

Hi everyone, I am quite a novice at php but I have created some helpful scripts that fetch data
from a ms access database that is used by our POS program at work ( a spa/salon)

My boss asked me to create a table kind of like this
which breaks down which clients an employee has seen and what months they have visited.

I've started by putting all the appointment data into an array
here my code
Code: <?php

$cn = odbc_connect(edge,admin,sharp);
$sql = "SELECT Code,FName,LName FROM Employees";
$res = odbc_exec($cn,$sql);

while(odbc_fetch_row($res))
{
$employees[odbc_result($res,'Code')] = array(fname=>odbc_result($res,'FName'),lname=>odbc_result($res,'LName'));
}


foreach($employees as $code => $details)
{
$sql2 = "SELECT ApptDate,CliDesc FROM Appointments WHERE EmpCode='".$code."' AND CliType<>'none'";
$res2 = odbc_exec($cn,$sql2);

while(odbc_fetch_row($res2))
{
$employees[$code]['appointments'][odbc_result($res2,'CliDesc')][] = odbc_result($res2,'ApptDate');
}
}

?>

I just can't wrap my mind about how I can create a table now...

Any suggestions or ideas would be awesome.

Thanks


PS
I have uploaded the sample database that the program demo comes with if you want to play around.
http://www.breze.ca/sample.mdb
Thanks for any help

Other forums