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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:40:34+00:00 2026-06-16T00:40:34+00:00

hello i have mysql select. i’m going to select loc from core. This loc

  • 0

hello i have mysql select. i’m going to select loc from core. This loc must select from rows which has dateid=(‘”.$dateid.”‘) and location=(‘”.$id.”‘) also i need to add two condition in WHERE. I mean can i do this like a WHERE dateid=(‘”.$dateid.”‘) AND location=(‘”.$id.”‘) AND BETWEEN ‘2012-10-1’ AND ‘2012-10-4′” this is not working.
how can i add this time span?

$SQL = "SELECT loc FROM core WHERE dateid=('".$dateid."') AND location=('".$id."')";

$result = mysql_query($SQL);
 if($result){
$db_field = mysql_fetch_array($result);
$rs[$i]=$db_field[$select[$i]];}

}

can i add start date and end date in where?
how can i do this?

  • 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-06-16T00:40:35+00:00Added an answer on June 16, 2026 at 12:40 am

    Just remove the braces in first two and add remaining two filters with AND operator. You should be good i.e.

      SELECT loc FROM core WHERE dateid=$dateid AND location=$id
           AND startdate = STR_TO_DATE('$startdate', '%d/%m/%y') 
           AND enddate = STR_TO_DATE('$enddate', '%d/%m/%y') ;
    

    I am assuming dateid and id are numeric fields while startdate and enddate are string values containing date values e.g. 12/12/2012.

    Please use the right column and variable names. Also provide to date format of your string.

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

Sidebar

Related Questions

Hello I have a problem with fetching required rows from MySQL table correctly within
Hello I have a query like this: SELECT otel_id FROM YAZILIM_menu_icerik WHERE YAZILIM_menu_icerik.menu_id =
hello all this seems to be my problem I have a table in mysql
I have a query that looks like this: SELECT id, description, default_error, custom_error FROM
Hello I have this problem: I have MySQL Database with collation latin1_bin . In
Hello I have a table has some info like this id | message 1
hello i'm going to get array data from for. i have a code but
I have this function: function OUTconf($conf_name){ $sql = mysql_query(SELECT CONF_VALUE FROM .prefix.CONFIG WHERE CONF_NAME='.$conf_name.')
I have this code: <?php include(db.php); $result = mysql_query(SELECT * FROM email); while($row =
hello I have question on nested select in mysql. I want a working query

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.