PHP Programming > Beginners - Learning PHP
Allow sql query to search INT fields where '1' is entered in field?
stephen_:
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!
stephen_:
Hi all,
I have a search script - http://pastie.org/private/xcgurjmysgqyhik46xvyka where I've tried to add
--- PHP Code: ---
OR carer status = '1'
OR childminder LIKE '1'
OR creche LIKE '1'
--- End code ---
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!
RaythXC:
don't enclose integers in the ' signs.
--- PHP Code: ---
OR carer status = 1
OR childminder LIKE 1
OR creche LIKE 1
--- End code ---
stephen_:
@RaythXC yes forgot about these....
RaythXC:
If that solved your problem, hit the topic solved button at the bottom. It helps us determine if we need to check it :)
Navigation
[0] Message Index
[#] Next page
Go to full version