how to filter fields
7 posts by 3 authors in: Forums > CMS Builder
Last Post: February 11, 2010 (RSS)
By vyskocil - February 6, 2010
list($docsRecords, $docsMetaData) = getRecords(array(
'tableName' => 'docs',
'where' => " catagories LIKE '%\temployment forms\t%' ", ));
When I use that I get no records found and the page shows nothing.
What code do I use to sort on the field catagories
Thanks
Re: [vyskocil] how to filter fields
By Dave - February 8, 2010
Try examining your records to see if they contain the values you are expecting. Comment out your 'where' line and then add this code a few lines below:
<?php showme($docRecords); ?>
Next, if that looks right, check the SQL that is being generated by temporarily adding this option:
'debugSql' => true,
Let me know if either of those help you find the problem.
interactivetools.com
Re: [Dave] how to filter fields
By vyskocil - February 8, 2010
Thanks, I had two problems. I had renamed the table column and forgot to change the script. The second part is the like syntax was wrong.
this is what didn't work
'where' => " catagories LIKE '%\temployment forms\t%' ", )); ?>[/#000000]
This is what did work
'where' => "catagory LIKE 'employment forms' ", )); ?>
Thanks for all your help.
Re: [vyskocil] how to filter fields
By vyskocil - February 8, 2010
???
suggestions.
Re: [vyskocil] how to filter fields
By Chris - February 9, 2010
Can you please attach your full PHP source code?
Also, example URLs showing the problem and what you want the page to look like would be very helpful.
Chris
Re: [chris] how to filter fields
The problem was somewhere in the viewer code. I couldn't see anything that looked out of place but I did delete all the code on my page and recopied the viewer code. Now it works fine. So the filter portion of the code was good. just something with the view code but that was easy enought to copy and replace.
Thanks.
Re: [vyskocil] how to filter fields
By Chris - February 11, 2010
Chris