Hi,
i have a table named "appointments". i want to list appointments in a custom page and group records by a field(visithour).
this is my appointments table sql:
CREATE TABLE IF NOT EXISTS appointments
(
id
int(11) NOT NULL AUTO_INCREMENT,
TreatmentID
int(11) NOT NULL,
VisitDay
date NOT NULL,
VisitHour
varchar(10) COLLATE utf8_unicode_ci NOT NULL,
VisitLength
int(3) NOT NULL DEFAULT '1',
patient
int(11) NOT NULL,
LastSession
enum('Y','N') COLLATE utf8_unicode_ci DEFAULT 'N',
Treatment
enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y',
note
text COLLATE utf8_unicode_ci,
adminuser
int(11) DEFAULT NULL,
SendSMS
enum('Y','N') COLLATE utf8_unicode_ci DEFAULT 'N',
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT AUTO_INCREMENT=21619 ;
this is my code:
<!-- new codes -->
<div class="panel panel-default">
<div class="panel-heading">appointmens list</div>
<div class="panel-body">
<?php
$sql = "SELECT " .
"patients
.FullName
AS FullName
," .
"appointments
.VisitHour
AS VisitHour
" .
" FROM appointments
JOIN patients
ON (appointments
.patient
= patients
.PatientID
)" .
" WHERE " .
"appointments
.VisitDay
= '".$_GET["visitdate"]."' GROUP BY VisitHour
";
echo $dbhelper->ExecuteHtml($sql, array("fieldcaption" => TRUE, "tablename" => array("appointments", "patients")));
?>
</div>
</div>
what's wrong with my code?
thank you
mansour