xlxprophetxlx Posted January 22, 2008 Share Posted January 22, 2008 I have two issues that I am unsure how to fix. There are products in the datebase that end in 84 for example 112284 or 545584 that need to be removed from the search based on a log in. Problem is that there are other products that contain 84 but are not at the end for example 158461 or 845632. I am currently trying to do REGEXP but no luck. The other issue is for some reason the search is allowing product numbers to pass and get results when I type in numbers but when I try to search under a product title "name" it will not display any results. Any help would be great. I think I have tried everything that I can think of. Attached is the source code. Thanks, -Mike [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/ Share on other sites More sharing options...
toplay Posted January 22, 2008 Share Posted January 22, 2008 I didn't look at your code, but for the first bullet, you can do: ... WHERE column_name REGEXP '84$' or ... WHERE column_name LIKE '%84' Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-446385 Share on other sites More sharing options...
xlxprophetxlx Posted January 23, 2008 Author Share Posted January 23, 2008 I've tried that before but all I get when I search is "There where no results for your search criteria" even if I try something random. The search seems to stop working when I put an elseif statement. Any thoughts? -Mike Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-446952 Share on other sites More sharing options...
xlxprophetxlx Posted January 23, 2008 Author Share Posted January 23, 2008 In addition, here is the columns for the tables *attached* [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-446962 Share on other sites More sharing options...
fenway Posted January 24, 2008 Share Posted January 24, 2008 What queries are you using? Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-447979 Share on other sites More sharing options...
xlxprophetxlx Posted January 24, 2008 Author Share Posted January 24, 2008 All my querys are in my first post. Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448017 Share on other sites More sharing options...
xlxprophetxlx Posted January 24, 2008 Author Share Posted January 24, 2008 I fixed the second issue but my first issue I am still having trouble with. The REGEXP does not seem like it is working at all. Is there any other way to accomplish this? -Mike Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448321 Share on other sites More sharing options...
xlxprophetxlx Posted January 24, 2008 Author Share Posted January 24, 2008 EDIT: When I use WHERE column_name REGEXP '84$' it and I type 84 in the search it will only return results ending in 84 I need to do the opposite . -Mike Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448325 Share on other sites More sharing options...
fenway Posted January 24, 2008 Share Posted January 24, 2008 You mean "LIKE '84%'" Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448366 Share on other sites More sharing options...
max_w1 Posted January 25, 2008 Share Posted January 25, 2008 i think you must try REGEXP '84%' Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448497 Share on other sites More sharing options...
xlxprophetxlx Posted January 25, 2008 Author Share Posted January 25, 2008 I try using 84% but it returns with no results Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-448909 Share on other sites More sharing options...
fenway Posted January 25, 2008 Share Posted January 25, 2008 I try using 84% but it returns with no results If used with LIKE, this will return all results that begin with 84. Quote Link to comment https://forums.phpfreaks.com/topic/87251-php-mysql-search/#findComment-449003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.