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 6643071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:00:22+00:00 2026-05-26T00:00:22+00:00

I am having trouble pulling a query where i want to return results that

  • 0

I am having trouble pulling a query where i want to return results that contain a particular word in a field AND that are between a certain date range. The query i am using now is:

        $month_no = date('m');
        $month_day = date('d');         
        $query="SELECT * FROM `table` WHERE ((user_purchased LIKE '%john%') AND (request_date BETWEEN '2011-$month_no-$month_day' AND '2011-$month_no-$month_day')) ";
        $result = mysql_query($query);
        $num_rows = mysql_num_rows($result);  echo $num_rows;

My date format in the ‘request_date field is like this:
2011-10-03 12:30:34

Any ideas on what i am doing wrong?

Thanks!

  • 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-26T00:00:23+00:00Added an answer on May 26, 2026 at 12:00 am

    What happens if you try:

    BETWEEN '2011-$month_no-$month_day 00:00:00' AND
    '2011-$month_no-$month_day 23:59:59')) ";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble with proper regex for RewriteCond RewriteCond %{REQUEST_URI} !^/foo/ Works as expected, that
I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I'm having trouble pulling text from Excel, it is pulling it correctly as far
I'm having trouble pulling comments into my template using django comments. I'd like to
from here Im having trouble understanding they say that ado.net does not include a
I would like to display clickable news headlines. But I'm having trouble pulling data
I’m having trouble with some dbml generated classes that don’t to resolve down to
I'm having trouble sending email using my gmail account. I'm pulling my hair out.
I am having trouble building a Python function that launches TkInter objects, with commands
I am having some trouble pulling RSS off of blogger page and publishing it

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.