Where statement with OR doesn't work
3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 2, 2013 (RSS)
Hi and thank you in advance for your help
I have two tables
Match
Team
And I have a problem with this code:
// load records
list($teamRecords, $teamMetaData) = getRecords(array(
'tableName' => 'team',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$teamRecord = @$teamRecords[0]; // get first record
// load records
list($matchRecords, $matchMetaData) = getRecords(array(
'tableName' => 'match',
'where' => "team_home =".intval($squadreRecord['num']) or "team_away =".intval($squadreRecord['num']),
'orderBy' => 'date_match ASC',
));
It works only with one team, but doesn't work when i put team_away OR team_home in where statement.
Could youl help me?
Orazio
Solved with this code
// load recordslist($teamRecords, $teamMetaData) = getRecords(array('tableName' => 'team','where' => whereRecordNumberInUrl(1),'limit' => '1',));$teamRecord = @$teamRecords[0]; // get first record// load recordslist($matchRecords, $matchMetaData) = getRecords(array('tableName' => 'match','where' => "team_home =".intval($squadreRecord['num']), 'orWhere => "team_away =".intval($squadreRecord['num']), 'orderBy' => 'date_match ASC',));
:-)
Hi Orazio,
Glad you've resolved the problem. Let me know if you have any other questions.
Thanks!
Greg
PHP Programmer - interactivetools.com