Jump to content

How to tie in a multiple choice search form to my PHP code?


CountryGirl

Recommended Posts

which would have worked if she had not have already had a pre-existing loop in place but nice example ;)

 

but she still can alter her query to have the WHERE in place for her search then match it with the % wilcard syntax.

 

Here is the fix:

 

 WHERE asmnt_parcel.Account LIKE '{$search}%'

 

this will match any partial searches with the % sign after it

Link to comment
Share on other sites

which would have worked if she had not have already had a pre-existing loop in place but nice example ;)

 

but she still can alter her query to have the WHERE in place for her search then match it with the % wilcard syntax.

 

Here is the fix:

 

 WHERE asmnt_parcel.Account LIKE '{$search}%'

 

this will match any partial searches with the % sign after it

 

Yes, I was doing that and it works, but what I'm having trouble with is tying in the 3 different choices to search by - account #, name & legal.

 

They are in my search form, but how do I tie my PHP code to make it so that when someone selects "name" they can search by Smith, John. Or when someone selects "Account #", they can search by the proper account number.

 

Thanks!

Qadoshyah

Link to comment
Share on other sites

Okay, I'm messing around with trying to figure this out. I tried the following:

 

WHERE $selectName = $search OR $selectName = $search OR $selectName = $search

 

and also

 

WHERE $selectName->Account = $search OR $selectName->OwnersName = $search OR $selectName->Legal = $search

 

And my search form is modified to look like this:

 

	<tr><td><select name="selectName[]" size="3" multiple="multiple">
                     <option value="<?php echo $selectName->Account;?>">Account #</option>
                     <option value="<?php echo $selectName->OwnersName;?>">Name</option>
                     <option value="<?php echo $selectName->Legal;?>">Legal</option>

 

But, that doesn't work. I get error messages back saying "Unknown column 'Array' in 'where clause':".

 

Am I anywhere close to tying this search in? Do I need to add something to my code (I think I probably do, I just don't know what!).

 

Thanks!!

 

Qadoshyah

Link to comment
Share on other sites

couldnt you do something like this :confused:

 

 

WHERE asmnt_parcel.Account LIKE '{$search}%' OR asmnt_parcel.OwnersName LIKE '{$search}%'  OR asmnt_legal.Legal LIKE '{$search}%'

 

Yes, I could. And I have done that. That has worked fine. But, when I try to add anymore OR statements to be able to search by let's say Parcel ID, the search starts slowing down and doesn't seem to work well. I have successfully done 4 OR statements, but after that, I can't add anymore in. They just take forever and never bring up the results page.

 

Qadoshyah

Link to comment
Share on other sites

what about something like this then :confused:

<?php
$query = "
        SELECT * FROM asmnt_parcel
        WHERE MATCH(asmnt_parcel.Account,asmnt_parcel.OwnersName,asmnt_legal.Legal) AGAINST ('$search')
    ";?> 

 

 

using this as an example you can add more Values ;)

Link to comment
Share on other sites

what about something like this then :confused:

<?php
$query = "
        SELECT * FROM asmnt_parcel
        WHERE MATCH(asmnt_parcel.Account,asmnt_parcel.OwnersName,asmnt_legal.Legal) AGAINST ('$search')
    ";?> 

 

 

using this as an example you can add more Values ;)

 

Full text searching doesn't work too well with my database because of the way I need results to be returned. I tried a full text BOOLEAN search also. It doesn't return exact results like I need it to. Just because of the way full text searching works. Like If I searched "Smith, Tom" it's going to return his result, but also anything with the word Tom in it. I need exact results returned.

 

That's why I think the multiple choice search form would be the best. But, so far, I can't figure out how to tie in the multiple choices!  :facewall:

 

Qadoshyah

Link to comment
Share on other sites

Sorry not to have posted recently, but had to sort something for a customer.

 

Are there still points in my original solution that you do not understand. Do you need help in making it specific to your form?

 

Yes, I do need help in making it specific for my form. I'm not understanding how exactly to implement it. I have a while loop (as I've posted up above). But, I really don't understand how to tie in the multiple choice search form.

 

Thank you for any help! No problem on the delay ;)!

 

Qadoshyah

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.