[ic] Accessing MySQL tables other than the default 'products' table using the search tag

Stefan Hornburg racke@linuxia.de
10 Feb 2001 04:31:08 +0100

"Sam Hui" <shui@lunamedium.com> writes:

> Hi,
> We have setup a simple catalog similar to the tutorial, but would like to
> setup additional tables under MySQL.  The problem we are having is that
> whenever we do a search on a table other than default products table using
> the loop search:
> [loop search="st=db/ra=yes/fi=table_X"]
>     column_A: [loop-field <table column_A>]
> [/loop]

Try [loop_data table_X column_A].

> It would seem to return blank or null.  Strangely though, if column_A also
> exists in the products table, the value returned would be from the products
> table not table_X.  Doing the same query using query tag:
> [query sql="select column_A from table_X" list=1]
>     column_A: [sql-param column_A]<br>
> [/query]
> works flawlessly in getting the correct column values.
> Here is our table/db setup in our catalog.cfg:
> Database        products        products.sql    dbi:mysql:interchange
> Database        products        USER    <mysql user>
> Database        products        PASS    <mysql password>
> Database        product_detail        product_detail.sql
> dbi:mysql:interchange
> Database        product_detail        USER    <mysql user>
> Database        product_detail        PASS    <mysql password>
> Another quick question, is this the only to declare tables (from the same
> database) for Interchange?  Hoping to see if there is a better way to do
> this.

Yes, AFAIK. Suggestions for improvements ?


LinuXia Systems && Cobolt NetServices, eCommerce and more
Shop- und Datenbanklösungen mit MiniVend, Firewalls auf Debian-Basis
http://www.linuxia.de - http://www.cobolt.net
--> Junior Officer of the MiniVend/Interchange Bug Patrol <---