Problem with 'WHERE'

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 18, 2012   (RSS)

Re: [gkornbluth] Problem with 'WHERE'

Hi Jerry,

Is this where clause used after a form is submitted or is there any data passed in the URL? As I think the most likely option is that getRecords is performing a search as well as using your WHERE statement. You should be able to fix this using the following code:

<?php
// load records
list($client_uploadsRecords, $client_uploadsMetaData) = getRecords(array(
'tableName' => 'client_uploads',
'where' => "first_name= 'Gerald' AND last_name= 'Kornbluth' AND project_title= 'Participation 2012'",
'debugSql' => true,
'allowSearch' => false, // optional, defaults to true, adds search info from query string
'loadUploads' => true, // optional, defaults to true, but set here just to be sure.

));
?>
<?php foreach ($client_uploadsRecords as $record): ?>
<?php foreach ($record['uploads'] as $upload): ?>

<?php $count = count($record['uploads']);?>

<?php endforeach ?>
<?php endforeach ?><br />
There are <?php echo $count ?> uploads


Let me know if this doesn't work.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Problem with 'WHERE'

Thanks Greg,

I think that was the issue.

Sorry, I should have seen it myself... :-))

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php