I know this might seem like a simple question, but its answer has been eluding me for quite some time now. I’m trying to return the number of rows from the databases using the WHERE clause. My query is as follows:
$query = "SELECT COUNT(*)
FROM nfl_current_season_games
WHERE home_team = 'Indianapolis Colts'
AND away_team = 'Chicago Bears'
AND week = '1'";
I’m 100% sure there is such a row. I’m looking right at it in phpmyadmin. No matter if I execute the query with pure SQL in phpmyadmin or in a browser via a php script, it still returns a value of 0. I tried using the var_dump function for the $away_team and $home_team variables with php and they’re both just fine. I don’t know where to go from here because this seems so odd.
Does anyone have any tips or clues?
Thanks,
Lance
you probably have blank stapces or a collation issue in one of the column.
I suggest you run the query with one condition at a time and try to find out which one is causing the issue.
When you find out, paste it here to see if we can help
EDIT:
try to do something like (not sure about the mysql syntax, but the idea is to trim to remove blanck spaces and send it to upper):