what to do with this code to fetch the current date matching record from database table

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 href="javascript:void(0);" onClick=window.open("detailticket.php?ticketid='.$row['ticketid'].'","Ratting","width=950,height=600,0,status=0,");>Detail</a>'; echo '&nbsp;'; // echo '<a 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(); ?> 
1

1 Answer

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.

7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like