$sql = mysql_query("SELECT DATE_FORMAT( timeslot, '%l:%i') as times FROM timeslots WHERE DATE(timeslot) = '$slot'");
$num_rows = mysql_num_rows($sql);
while ($row = mysql_fetch_array($sql)) {
$times[] = $row['times'];
}
I had to alter the hour variable to drop the leading 0… ie 01:00 apposed 1:00
I guess the main advantage to date_format() aposed to concat() is the ability to format the date result?
Yea the table and field name are very similar… maybe bad practice, I try to name my tables and fields relative so they are easy to remember while writing the code to interact with the tables.
I also want to display the clients name etc that have appointments on the selected date and display info on the same screen the above query is being displayed on. At the moment I have built a seperate query.
$sql = mysql_query("SELECT c.*, t.*
FROM clients as c
JOIN timeslots as t ON t.clientid = c.clientid
WHERE DATE(t.timeslot) = '$slot'
ORDER BY t.timeslot ASC") or die (mysql_error());
while ($row = mysql_fetch_array($sql)) {
foreach($row as $key=>$value){
$$key = ValidateOutput($value);
}
Would it be plusable to put the 2 querys into a single one or keep them as seperate querys?