I have 3 tables.
Episode, Season, Episode_Season
I have made a view as such
"CREATE VIEW episode_season_view AS SELECT * FROM episode
INNER JOIN episode_season ON episode.id = episode_season.episode_id
INNER JOIN season ON season.id = episode_season.season_id";
Which btw works like a charm... Now when I run this query in MysqlWorkbench
"SELECT * FROM season_episode_view
WHERE first_aired > CURDATE() AND season_id = 600";
it returns the correct result. But when i do this,
R::getRow("SELECT * FROM season_episode_view
WHERE first_aired > ? AND season_id = ?", array(date('Y-m-d'), $season_id));
it returns 0 rows... and I cant understand why?
This is just a guess, but rather than using PHP's date functions, use Redbean's MySQL functions and possibly
getAll()
:If that doesn't work, you can try the built in querying:
Only other thing I can think of is that the
first_aired
column doesn't like PHP'sdate()
for some reason, possibly due to the field type?