Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6068997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:46:30+00:00 2026-05-23T09:46:30+00:00

I have a invoice type form submission and every submission has a date so

  • 0

I have a invoice type form submission and every submission has a date so I have created a varcha date field in mysql database to save the time.Time format is like ‘2011-06-26’.Now I need to select a range based on the date from my database.I tried following options but they don’t display any result just blank page is displayed,even no errors.

Should I follow some special techniques on saving date to my database.If so please give me some explain about that because I am new to PHP and MYSQL development.

SELECT * FROM table_name 
WHERE 'date' 
BETWEEN UNIX_TIMESTAMP('2011-06-02') AND UNIX_TIMESTAMP('2011-06-25')




SELECT * FROM my_table 
WHERE 'date' 
BETWEEN CAST('2011-06-02' AS DATE) AND CAST('2011-06-25' AS DATE)";

This is what I used to extract data

$result=mysql_query($query);
  while($row=mysql_fetch_array($result)){
      echo $row['tax']."<br>";
  }

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:46:30+00:00Added an answer on May 23, 2026 at 9:46 am

    If you use DATETIME type to store your date the trick is simple.
    DATETIME allows you to store the date and the timestamp, however if only the date is specifed, timestamp will be stored as 00:00:00

    I’ll show you a simple example.

    mysql> CREATE TABLE test_table(
           id INT UNSIGNED AUTO_INCREMENT,
           test_date DATETIME,
           PRIMARY KEY (id));
    
    mysql> INSERT INTO test_table(test_date) 
           VALUES('2011-06-26'), ('2011-05-14'), ('2011-05-02');
    
    mysql> SELECT * FROM test_table;
    +----+---------------------+
    | id | test_date           |
    +----+---------------------+
    |  1 | 2011-06-26 00:00:00 |
    +----+---------------------+
    |  2 | 2011-05-14 00:00:00 |
    +----+---------------------+
    |  3 | 2011-05-02 00:00:00 |
    +----+---------------------+
    
    mysql> SELECT * FROM test_table WHERE test_date
           BETWEEN '2011-05-01' AND '2011-05-31';
    +----+---------------------+
    | id | test_date           |
    +----+---------------------+
    |  2 | 2011-05-14 00:00:00 |
    +----+---------------------+
    |  3 | 2011-05-02 00:00:00 |
    +----+---------------------+
    

    That’s it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with these rows: <td> - </td> <input id=invoice_invoice_line_items_attributes_2_item_type name=invoice[invoice_line_items_attributes][2][item_type] type=hidden
Let's say I have a table like this: Customer,Invoice Type,Balance A,Good,50 A,Good,10 A,Bad,20 B,Good,20
I have a query invoice which only updates the total values when a field
I have to read invoice ascii files that are structured in a really convoluted
Some background: In Germany (at least) invoice numbers have to follow certain rules: The
I have tree tables, Customer, Invoice and InvoiceRow with the standard relations. These I
I have a page with 2 frames. In the top frame is a form
I have a UserControl that has a BaseClass object as a public member. Right
I have a class, Document and several sub-classes ( Invoice , PurchaseOrder , etc).
I have an invoice spreadsheet with comboboxes to select a product which fills out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.