[snip]
p.s. do you use backticks in all your qeuries?
[/snip]
It's just a good habit! :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Thu, 8 Jul 2004 13:14:50 -0500, Jay Blanchard
<[EMAIL PROTECTED]> wrote:
> Do it with SQL
>
> SELECT DISTINCT(SUBSTRING(`productName`, 1, 1)) FROM `productTable`
>
> will give you only one of each of the starting letters that actually
> occur in your database.
good job. that works great. it's
> 1. pull a list of products from the database
> 2. truncate each product id down to it's first letter
> 3. remove all the duplicates
> 4. use this list to build the links.
I would let sql do some of the work.
select count(*) from products where product_name like 'A%'
if count does not return 0
[snip]
currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.
[/snip]
Do it with SQL
SELECT DISTINCT(SUB
I doubt this function is going to make your script more efficient, but you could also
make use of the array_intersect () function.
-Original Message-
From: barophobia <[EMAIL PROTECTED]>
Sent: Jul 8, 2004 10:47 AM
To: php-general <[EMAIL PROTECTED]>
Subject: [PHP] Link
hello.
in an effort to more easily find products in the cart i'm building
i've given the ability to the user to click a letter from the alphabet
to search for all products whose product id starts with that letter.
currently each letter is hyper linked but i'd like to only link the
letters that ha
6 matches
Mail list logo