Problem with Double WHERE statement

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 8, 2010   (RSS)

Re: [zip222] Problem with Double WHERE statement

By Jason - September 8, 2010

Hi,

The where statement has to be a string. Try this:

<?php
$where="1";

if(!$CURRENT_USER['staff']){
$where = "conflicts_of_interest NOT LIKE '%\t".intval($CURRENT_USER['num'])."\t%'";
}

list($applicationsRecords, $applicationsMetaData) = getRecords(array(
'tableName' => 'applications2010',
'where' => "$where AND full=1",
));

?>


You'll want to use $where="1" because if the current user is not staff, you'll have an "AND" in your where clause with no initial where statement. This would result in an error.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/