i want to use the funtion DAYNAME, but will get this date from a form, and depends of the day of the week, the person who create the form will win more points
i think something like this
if ($row['DAYNAME($Data)'] == "Monday") {
$suma1=1;
} elseif ($row['DAYNAME($Data)'] == "Tuesday"){
$suma1=1;
} elseif ($row['DAYNAME($Data)'] == "Wednesday"){
$suma1=1;
} elseif ($row['DAYNAME($Data)'] == "Thursday"){
$suma1=1;
} elseif ($row['DAYNAME($Data)'] == "Friday"){
$suma1=1;
} elseif ($row['DAYNAME($Data)'] == "Saturday"){
$suma1=2;
} elseif ($row['DAYNAME($Data)'] == "Sunday"){
$suma1=2;
}
the problem is here
i have this...
<?php
$db = "sp28";
$dbh = new PDO("mysql:host=$hostname;dbname=$db", $username, $password);
foreach($dbh->query('SELECT DAYNAME("2017-04-06")') as $row) {
echo "<tr>";
echo "<td>" . $row['DAYNAME("2017-04-06")'] . "</td>";
echo "</tr>";
but i want have like this, the variable in DAYNAME,but it doesnt work
<?php
$Data="2017-04-06";
$db = "sp28";
$dbh = new PDO("mysql:host=$hostname;dbname=$db", $username, $password);
foreach($dbh->query('SELECT DAYNAME("$Data")') as $row) {
echo "<tr>";
echo "<td>" . $row['DAYNAME("$Data")'] . "</td>";
echo "</tr>";
}
?>