I am trying to add a variable inside a variable
How can I do it ?
Here is my code, in which I have to place $day in the place of Mon (line 9) so that it echo data from SQL database according to the day of week.
Here is my code
<?php
include_once("config.php");
date_default_timezone_set('Asia/Kolkata');
//$timestamp = time();
$day = "" . date("D");
$result = mysqli_query($mysqli, "SELECT * FROM Time_table WHERE regd='". $_SESSION['TextBox1'] ."' ORDER BY id DESC");
while($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td style='width: 30%'>".$res['Mon']."</td>";
echo "<td style='width: 30%'>".$res['time']."</td>";
echo "<td style='width: 40%'>".$res['room_no']."</td>";
}
?>
so that the line 9 should look like
echo "<td style='width: 30%'>".$res['$day']."</td>";
but it is wrong, I am able to figure it out how to do.
$resor$result?echo "<td style='width: 30%'>".$res['Mon']."</td>";toecho "<td style='width: 30%'>".$res['$day']."</td>";$res[$day]? I don't see how that could help though. Or do you have a column for every day in your table?