Jump to content

echo date field from MySQL table


f.ismayil

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.