what i do more with this code to fetch current date records from mysql database table i want to fetch same day records from table date is present in my table in 'duedt' field from which i am matching current date here is code help me out thanks in advance
$curdate= date("Y-m-d");
$result = mysql_query("SELECT ticketid,duedt
FROM tickets
WHERE duedt = 'curdate'
");
while($row=mysql_fetch_array($result))
{
$dayname='SAMEDDAY';
echo '<tr>';
echo '<td>'. $row['ticketid'] . '</td>';
echo '<td>'. $row['duedt'] . '</td>';
// echo '<td>'. $row['WEEKDAY(duedt)'] . '</td>';
echo '<td>' .$dayname. '</td>';
echo '<td>';
echo '<a class="btn btn-primary btn-s" href="javascript:void(0);" onClick=window.open("detailticket.php?ticketid='.$row['ticketid'].'","Ratting","width=950,height=600,0,status=0,");>Detail</a>';
echo ' ';
// echo '<a class="btn btn-success btn-s" href="javascript:void(0);" onClick=window.open("collectticket.php?ticketid='.$row['ticketid'].'","Ratting","width=950,height=600,0,status=0,");>Complete</a>';
echo '</td>';
echo '</tr>';
}
Database::disconnect();
?>
You are not using the PHP variable in your query, please try this:
$curdate = date("Y-m-d");
$query = "SELECT ticketid, duedt FROM tickets WHERE duedt = '" . $curdate . "'";
$result = mysql_query($query);
Also, please consider using mysqli_*
functions to access your database, as mysql_*
functions are deprecated and will be removed in future PHP versions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.