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> Quote Link to comment 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) Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.