URGENT 'WHERE' with lists

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 2, 2009   (RSS)

By terryally - January 2, 2009

Happy New Year to all!

I have used the WHERE clause successfully in the past but I just got stumped trying to use it with a list.

I.E. I have a gender field with two checkboxes "Male" and "Female". So now I want to display records for males only and so I used 'where' => 'gender="Male"', but it displays nothing.

When I generate the code for a full listing it displays that particular field as:

<?php echo join(', ', getListLabels('seeds_and_qualifiers', 'gender', $record['gender'])); ?>

Oddly enough when I do a search directly in the MYSQL database, I am getting nothing either.

Any ideas?

This is fairly urgent because I need to get this page up by tomorrow morning.


Re: [terryally] URGENT 'WHERE' with lists

By Dave - January 2, 2009

Hi Terry,

I'd switch your field to a single value list pulldown. Multiple checkbox fields are meant to store multiple values (eg: Male and Female) and they store it as tab delimited values.

If you switch back to a single value list pulldown it will be much easier. Let me know if that works for you.
Dave Edis - Senior Developer

Re: [Dave] URGENT 'WHERE' with lists

By terryally - January 2, 2009

Hi Dave,

I've switched as recommended and it works.

I omitted to say that it was both checkboxes and radio buttons that the WHERE clause was not working.