how to filter fields

7 posts by 3 authors in: Forums > CMS Builder
Last Post: February 11, 2010   (RSS)

I have set up a document managemt system using a multi record. I have separate tables for each type of form. catagory. For example there is a table named employment forms. in that table there is an upload field and a text field named catagory. catagory is labeled Employment Forms so that will be echo'd to the page. So in that one table I have the documents for employment. Then there is another table set up the same named registrations for registration documents. On the website there is a documents page that shows all documents for download and are listed by catagory. What I want to do is on a separate page to list just one catagory from that multi record. So on a page that references registrations that I could pull just the documents having to do with registrations. I tried add the like statement

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

Hi vyskocil,

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.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] how to filter fields

Hi Dave,

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

That didn't fix the problem like I thought. The links now show. They look identical to the links on the documents page but they don't point to the pdf files when I filter out by category

???

suggestions.

Re: [vyskocil] how to filter fields

By Chris - February 9, 2010

Hi vyskocil,

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.
All the best,
Chris

Re: [vyskocil] how to filter fields

By Chris - February 11, 2010

Great to hear you got everything working! :)
All the best,
Chris