Yay, more of me coding and being shit at it.
Simple one (I think)
I have a database with this table..
date |
day |
month |
year |
dayofweek |
weight |
2010-08-03 |
03 |
August |
2010 |
Tuesday |
82.5 |
And that's an example of the data within it.
All I want to do is to be able to select certain rows based on month and year, or year
Eg..
Everything from August 2010
Everything from 2010
I'm guessing using WHERE is the way to go and currently I'm going for it using the URL and grabing the variable from there but I have an issue.
Using...
PHP code:
$month = $_GET['month'];
$year = $_GET['year'];
PHP code:
$sql="SELECT * FROM weight WHERE month='$month' & year='$year' OR year='$year'";
Eg :
1)
http://server/page.php?year=2010 - Gives everything from 2010
2)
http://server/page.php?month=August&year=2010 - Gives everything from 2010 and not August 2010
I can kinda see why it's happening but don't know how to sort it
:C