Using Substring with REGEX

From: Date: Mon, 05 Aug 2002 14:50:15 +0000
Subject: Using Substring with REGEX
Groups: php.db 
Request: Send a blank email to php-db+get-20994@lists.php.net to get a copy of this message
I'm attempting to retrieve records in my DB in an e-commerce situation. The customer searches products where the information on the most common size article is used to display the record information (obviating the need to display a separate record for each size). Using a radio button, the customer then selects a size. All sizes of the same article have similar item #s (primary key) except for the last digit of 11 ( a000000001a, a000000001b, etc.). I'm attempting to use SUBSTRING and REGEX to pull up the proper record and believe that there is something wrong with the syntax I am using (have found no examples of what I am trying to do). The query I am using: "SELECT * FROM $table WHERE item_no RLIKE 'SUBSTRING($selected_item_no, 0, -1)' AND size='$selection'" In most of my attempts, I either get the empty set or a message that my syntax is incorrect. Any suggestions? Michael Conway mconway3@cox.net (703) 968-8875

« previous php.db (#20994) next »