Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Wie setze ich den Namen des Datumstages von Datepicker als Spaltennamen in der MySQL-Datenbank?

Für PHP-Code

$weekday[0]="Sun";
$weekday[1]="Mon";
$weekday[2]="Tues";
$weekday[3]="Wed";
$weekday[4]="Thur";
$weekday[5]="Fri";
$weekday[6]="Sat";


$date = '2011/10/14'; 
$dayName = date('D', strtotime($date));
$dayNumber = date('N', strtotime($date));
echo $dayName; //date name 
$prefix = $weekday[$dayNumber]; //custom date name
$query = "select * from table_name where $prefix = 'Y'";