OK That cleared up the whole 'date' part of my query. Thanks, for some reason I was swapping the month and day. Duh...
Moving on, I still get wierd numbers returned when I do counts. I have a page where I want to count rows with different requirements. I have saved each query in it's own file then I include them in the page where they are supposed to go. I don't know if that's the best way but I didn't want to have conflicts so I separated them.
In my table these are the columns and the type I'm concerned with in order:
date (date), field_1 (char), field_2 (char), cancelled (enum y,n)
Here is the query (they all look like this only with different date and cancelled requirements)
Code: Select all
$connection = mysql_connect("$DbHostName", "$DbUserName", "$DbPassWord");
$sql = "select * from games where field_1 = '$var' || field_2 = '$var' && cancelled = 'y'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
echo $count;
This particular query gives me a 2 when there are NO records that match those particular specifications. And what really gets me is if I say cancelled = 'n' it works fine...
What am I missing?