Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Tommy Pham
- Original Message > From: Paul M Foster > To: php-general@lists.php.net > Sent: Friday, September 4, 2009 9:15:08 PM > Subject: Re: [PHP] Searching on AlphaNumeric Content Only > > On Fri, Sep 04, 2009 at 08:15:41PM -0400, Robert Cummings wrote: > > > Paul

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Paul M Foster
On Fri, Sep 04, 2009 at 08:15:41PM -0400, Robert Cummings wrote: > Paul M Foster wrote: >> On Fri, Sep 04, 2009 at 04:22:18PM -0400, Eddie Drapkin wrote: >> >>> On Fri, Sep 4, 2009 at 12:02 PM, Lupus >>> Michaelis wrote: >> >>> if you're on shared hosting (but then again I am of the opinion >>> th

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Robert Cummings
Paul M Foster wrote: On Fri, Sep 04, 2009 at 04:22:18PM -0400, Eddie Drapkin wrote: On Fri, Sep 4, 2009 at 12:02 PM, Lupus Michaelis wrote: if you're on shared hosting (but then again I am of the opinion that those who choose to run with shared hosting dig their own graves in more ways than

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Paul M Foster
On Fri, Sep 04, 2009 at 04:22:18PM -0400, Eddie Drapkin wrote: > On Fri, Sep 4, 2009 at 12:02 PM, Lupus > Michaelis wrote: > if you're on shared hosting (but then again I am of the opinion > that those who choose to run with shared hosting dig their own graves > in more ways than one). Any time

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Tommy Pham
- Original Message > From: Robert Cummings > To: Eddie Drapkin > Cc: Lupus Michaelis ; php-general@lists.php.net > Sent: Friday, September 4, 2009 1:36:08 PM > Subject: Re: [PHP] Searching on AlphaNumeric Content Only > > Eddie Drapkin wrote: > > On Fri, Sep

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Robert Cummings
Eddie Drapkin wrote: On Fri, Sep 4, 2009 at 12:02 PM, Lupus Michaelis wrote: Ashley Sheridan a écrit : You'll have far greater performance issues if you retrieve all those records and attempt to do the same thing inside of PHP... It's why I speak about « avoiding » and not « bannishing ». Li

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Eddie Drapkin
On Fri, Sep 4, 2009 at 12:02 PM, Lupus Michaelis wrote: > Ashley Sheridan a écrit : > >> You'll have far greater performance issues if you retrieve all those >> records and attempt to do the same thing inside of PHP... > >  It's why I speak about « avoiding » and not « bannishing ». Like can be > u

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Lupus Michaelis
Ashley Sheridan a écrit : You'll have far greater performance issues if you retrieve all those records and attempt to do the same thing inside of PHP... It's why I speak about « avoiding » and not « bannishing ». Like can be usefull, I used to use it. But it is not the a good answer to all

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Ashley Sheridan
On Fri, 2009-09-04 at 17:00 +0200, Lupus Michaelis wrote: > Ashley Sheridan a écrit : > > What's wrong with using the wildcards that are built into most SQL > > variants? > >Performance issues. Like is an operator to avoid when possible. > > -- > Mickaël Wolff aka Lupus Michaelis > http://lu

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-04 Thread Lupus Michaelis
Ashley Sheridan a écrit : What's wrong with using the wildcards that are built into most SQL variants? Performance issues. Like is an operator to avoid when possible. -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, v

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
> > stripping, stemming, spelling corrections ? >  ... uhm, that's probably why they invented regular expressions, isn't it? > > As I said, at the end of the day, this will be a manual slow, potentially > wrong implementation of what we already have and use on daily basis. If you've got a regular

RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi
stripping, stemming, spelling corrections ? ... uhm, that's probably why they invented regular expressions, isn't it? As I said, at the end of the day, this will be a manual slow, potentially wrong implementation of what we already have and use on daily basis. But obviously, everybody is free

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Paul M Foster
On Thu, Sep 03, 2009 at 12:12:40PM -0700, sono...@fannullone.us wrote: > Thanks to everyone who has responded. After reading everyone's > response, I think I have a very simple way to solve my "problem". > > Using my original example, if someone wants to find item # > 4D-2448-7PS, no

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Tommy Pham
- Original Message > From: "sono...@fannullone.us" > To: PHP General List > Sent: Thursday, September 3, 2009 12:12:40 PM > Subject: Re: [PHP] Searching on AlphaNumeric Content Only > > Thanks to everyone who has responded. After reading everyone's

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Eddie Drapkin
On Thu, Sep 3, 2009 at 3:17 PM, Ashley Sheridan wrote: > On Thu, 2009-09-03 at 12:12 -0700, sono...@fannullone.us wrote: >>       Thanks to everyone who has responded.  After reading everyone's >> response, I think I have a very simple way to solve my "problem". >> >>       Using my original examp

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ashley Sheridan
On Thu, 2009-09-03 at 12:12 -0700, sono...@fannullone.us wrote: > Thanks to everyone who has responded. After reading everyone's > response, I think I have a very simple way to solve my "problem". > > Using my original example, if someone wants to find item # > 4D-2448-7PS, no mat

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread sono-io
Thanks to everyone who has responded. After reading everyone's response, I think I have a very simple way to solve my "problem". Using my original example, if someone wants to find item # 4D-2448-7PS, no matter what they type in, I'll take the input, strip out all non-alphanumeric charac

RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi
> Even if the REGEXP has to change with every query? Ben, it does not matter, this is not a PHP problem but a DB structure/select/insert/update problem. Whatever REGEXP you use, a REGEXP is what you need to solve this problem, certainly not a PHP loop over each row with operations for each row

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
> What's wrong with using the wildcards that are built into most SQL > variants? > > SELECT * FROM table WHERE item_id LIKE '%#abcdef' > > Will select all records where the item_id field ends in '#abcdef' That works if you know the user is always going to enter the last 7 characters of the product

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
> Excuse me? Somebody suggested a PHP loop to solve a query problem and you are > saying that REGEXP should not be used? > MySQL caches queries and 100 SELECT with a REGEXP will cost zero after the > first one if nothing changed inside the table. Even if the REGEXP has to change with every query

RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi
> Indeed you could do it via a regexp, but that uses up quite some memory. > Every time you do a SELECT. You can simply add a table column with the > stripped value and let the table update itself (with an ON UPDATE ON > INSERT trigger, which takes the input value for the itemID and strips it

RE: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Andrea Giammarchi
Which DB? If it is MySQL, as example, you can simply use REGEXP syntax "^[a-zA-Z0-9]+$" via SELECT Regards > From: sono...@fannullone.us > To: php-general@lists.php.net > Date: Wed, 2 Sep 2009 20:47:15 -0700 > Subject: [PHP] Searching on AlphaNumeric Content Only >

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ashley Sheridan
On Wed, 2009-09-02 at 21:30 -0700, Ben Dunlap wrote: > >Is there is a way to search only for the alphanumeric content of > > field in a db? I have an itemID field that contains item #'s that include > > dashes, forward slashes, etc, and I want people to be able to search for an > > item #

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-02 Thread Ben Dunlap
>        Is there is a way to search only for the alphanumeric content of > field in a db?  I have an itemID field that contains item #'s that include > dashes, forward slashes, etc, and I want people to be able to search for an > item # even if they don't enter the punctuation exactly. Not sure i

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-02 Thread German Geek
Hi, It's definitely possible to do when you do it in PHP, but not sure about on the database side. You could read all records into memory and then iterate over it with something like: $toSearch = "4D24487PS" $charsToIgnore = array('-','+',...); foreach ($items as $k=>$item) { $itemVal = str_re

[PHP] Searching on AlphaNumeric Content Only

2009-09-02 Thread sono-io
Is there is a way to search only for the alphanumeric content of field in a db? I have an itemID field that contains item #'s that include dashes, forward slashes, etc, and I want people to be able to search for an item # even if they don't enter the punctuation exactly. Here's an exampl