f.ismayil Posted April 21, 2011 Share Posted April 21, 2011 Here is one part of php code. Here I try to show in last 1 month which dates exactly user made orders. When I run the SQL code in command prompt it works. I think problem is in while loop. Thanks beforhand for contribution. $query = "SELECT Date FROM orders WHERE User='$username' and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Date;"; $result = mysql_query($query,$link_id) or die (mysql_error()); echo "<table border='1'> <tr> <td> Last 1 month's orders:</td> </tr>"; while($order_date = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>" . $order_date[0] . "</td>"; echo "</tr>"; } echo "</table> Link to comment https://forums.phpfreaks.com/topic/234324-echo-date-field-from-mysql-table/ Share on other sites More sharing options...
Barand Posted April 21, 2011 Share Posted April 21, 2011 It could just be there are no records for the user whose name is in $username (have you checked there is a valid value in $username) Link to comment https://forums.phpfreaks.com/topic/234324-echo-date-field-from-mysql-table/#findComment-1204421 Share on other sites More sharing options...
f.ismayil Posted April 21, 2011 Author Share Posted April 21, 2011 Ohhh yes. You are right. Just a day ago I changed my program. Now it is linked to database in hosting location not to local database. And hosting database was empty Thank you very much Barand. You gave me super solution Link to comment https://forums.phpfreaks.com/topic/234324-echo-date-field-from-mysql-table/#findComment-1204507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.