I'm having trouble finding or figuring out how to display the MySQL date field as the shortened day of the week.
I am not sure whether to do this in MySQL or PHP.
Ideally, I would like to do this using the PHP function, but to complicate the situation, the date field that I want to display as the day of the week is executed through a while loop to the table. This makes me think that I need to do this in MySQL.
Basically, I want to be able to use something like PHP mktime () or MySQL DAYOFWEEK (), except that I need to be able to do this in a while loop, I need to be able to use a variable or name columns in a function instead to enter or pull out one specific date for formatting.
Any help is much appreciated!
PS I added below how the data is currently coming from the database. ### where I am having problems; this is where I need to repeat Day using the column "e_date". (The next date also uses the column "e_date".)
$result = mysql_query("
SELECT *
FROM events
WHERE e_type != '' && e_date >= CURDATE() && e_date <= (CURDATE() + 15)
ORDER BY e_date,e_ampm,e_time")
or die(mysql_error());
echo "<table border='1' style=\"border:none;font-size:12px;\">";
echo "<tr> <th>Day</th> <th>Date</th> <th>Time</th> <th>Type</th> <th>Description</th> </tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo "</td><td>";
echo $row['e_date'];
echo "</td><td>";
echo $row['e_time'];
echo $row['e_ampm'];
echo "</td><td>";
echo $row['e_type'];
echo "</td><td>";
echo $row['e_name'];
echo "</td></tr>";
}
echo "</table>";
source
share