darkfreaks Posted February 9, 2010 Share Posted February 9, 2010 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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1009577 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010114 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 Hi Just digesting what you have posted, then will come up with some suggestions for you Thanks! Qadoshyah Link to comment https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010116 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010213 Share on other sites More sharing options...
darkfreaks Posted February 10, 2010 Share Posted February 10, 2010 couldnt you do something like this WHERE asmnt_parcel.Account LIKE '{$search}%' OR asmnt_parcel.OwnersName LIKE '{$search}%' OR asmnt_legal.Legal LIKE '{$search}%' Link to comment https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010215 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 couldnt you do something like this 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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010223 Share on other sites More sharing options...
darkfreaks Posted February 10, 2010 Share Posted February 10, 2010 what about something like this then <?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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010229 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 what about something like this then <?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! Qadoshyah Link to comment https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010269 Share on other sites More sharing options...
jl5501 Posted February 10, 2010 Share Posted February 10, 2010 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? Link to comment https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010275 Share on other sites More sharing options...
CountryGirl Posted February 10, 2010 Author Share Posted February 10, 2010 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 https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010283 Share on other sites More sharing options...
darkfreaks Posted February 10, 2010 Share Posted February 10, 2010 http://www.dalehay.com/comment/494/ this might help Link to comment https://forums.phpfreaks.com/topic/191085-how-to-tie-in-a-multiple-choice-search-form-to-my-php-code/page/2/#findComment-1010292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.