WiredWX Christian Hobby Weather Tools
Would you like to react to this message? Create an account in a few clicks or log in to continue.

WiredWX Christian Hobby Weather ToolsLog in

 


descriptionSQL statement (SOLVED ready for the trash) ^^ EmptySQL statement (SOLVED ready for the trash) ^^

more_horiz
Hi,

I have page that allows the user to search using a "date range" AND "location".
I'm able to do this individually.
Its like, if the user searches using the date range (from begin date to end date) the results show.
Then if the user searches using a specific location (lets say USA) the results show.

but when the user searches using the date range AND the location, i get an error.

this is my code for the date range.

Code:


$data = mysql_query("SELECT * FROM table WHERE date BETWEEN '$beginDate' AND '$endDate' ");

and this is for the location

Code:


$data = mysql_query("SELECT * FROM table WHERE location = '$loc' ");


and this is for the combined range and location. (which generates an error)

Code:


$data = mysql_query("SELECT * FROM table WHERE date BETWEEN '$beginDate' AND '$endDate' AND  location = '$loc' ");


what do you think i should do?
Yikes

Last edited by charvie on 28th May 2010, 7:02 am; edited 1 time in total

............................................................................................

SQL statement (SOLVED ready for the trash) ^^ Charvi10

THIS SIGNATURE IS BY::: AGENT COSMIC ----------QUOTE BY:::TECHY

descriptionSQL statement (SOLVED ready for the trash) ^^ EmptyRe: SQL statement (SOLVED ready for the trash) ^^

more_horiz
it's already solved.
just placed parenthesis correctly ^^

............................................................................................

SQL statement (SOLVED ready for the trash) ^^ Charvi10

THIS SIGNATURE IS BY::: AGENT COSMIC ----------QUOTE BY:::TECHY
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum