Allow sql query to search INT fields where '1' is entered in field?

Apologies for the vauge title. I’m trying to build a search database of services for children. Within my database there are a number of INT fields which represent different service types. E.g if a service is a childminder then a ‘1’ is entered in the $childminder field if not it is 0 (NULL).

My form is a simple wild card and area search - http://pastie.org/private/xcgurjmysgqyhik46xvyka, yet I’d really like to allow the $sql_result to search for any INT fields (that have a ‘1’ in them) to be shown in the results as well, so that if someone types childminder all rows with the childminder INT column marked ‘1’ will show up.

I’d also like to add a simple pagination as well yet I’m getting v.confused - appreciate any help out there!

Hi all,

I have a search script - http://pastie.org/private/xcgurjmysgqyhik46xvyka where I’ve tried to add

[php]
OR carer status = ‘1’
OR childminder LIKE ‘1’
OR creche LIKE ‘1’
[/php]

to allow a list of INT fields that have a 1 to show up as well so that if someone types in org_name, carer then any rows in my DB which have a ‘1’ in the carer INT field will also show up - but having no luck…

Please could someone help - a bonus would be to allow pagination as well but maybe asking too much!

don’t enclose integers in the ’ signs.

[php]
OR carer status = 1
OR childminder LIKE 1
OR creche LIKE 1
[/php]

@RaythXC yes forgot about these…

If that solved your problem, hit the topic solved button at the bottom. It helps us determine if we need to check it :slight_smile:

No I’m still not getting my query to pick up - but appreciate your help.

i’ll take a look through the whole code tomorrow. i’m headin to bed atm but i’ll get to it.

Cheers, much appreciated - let me know if I can send you a schema of the DB?

Sponsor our Newsletter | Privacy Policy | Terms of Service