On Tuesday 09 November 2004 09:21 am, Shanta McBain wrote:
> > [% FOREACH link = DBI.query("SELECT * FROM url_tb
> >                                   WHERE  products  LIKE 'honey'
> >                                   AND (site_name =  'Apis' OR
> > site_name = 'All')
> >                                   ORDER BY link_order
> >                                   ")%]

I used PHPMyAdmin to create the fallowing code which works in PHPMyAdmin.

SELECT * 
FROM `address_book_tb` 
WHERE `category` = 'beekeeper'
AND `products` LIKE '%Pollinator%'
ORDER BY `company_name` ASC 

This returns the only record in the table that contains the right info.

In TTML
[% FOREACH link = DBI.query("SELECT * 
                                FROM address_book_tb 
                                          WHERE category = 'beekeeper'
                                          AND products LIKE '%Pollinator%'
                                          ORDER BY company_name ASC 
                                  ")%]    

works

[% FOREACH link = DBI.query("SELECT * 
                                FROM 'address_book_tb' 
                                          WHERE 'category' = 'beekeeper'
                                          AND 'products' LIKE '%Pollinator%'
                                          ORDER BY 'company_name' ASC 
                                  ")%]    

This dose not work. Troughs a TTML error

Seems TTML dose not like the single quotes around the table and field names.

Now to learn to link tables on entry and to join them on select. From Perl and 
TTML. This will  not be as easy.

A note on the storage of data in the field it actually is stored like.

Nuces,Wax,Pollen,Honey,Pollinator,Queens Seems the web app places the contents 
of the field into a , delimeted string.

So it needs the %.  The '_' one character or just 'word' will not work. 



--
Thanks
Shanta McBain
Http://computersystemconsulting.ca Web hosting and Application Hosting.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to