[ic] Query iteration

Mike Heins mikeh@minivend.com
Thu, 29 Mar 2001 19:07:47 -0500

Quoting Jean-Pierre Parent (parentjp@videotron.ca):
> Hi,
> I've been reading the doc and cant find a complete example on how to do a
> custom query and iterate over the returned records. Does one need use
> [mvasp][/mvasp] surrounded code in order to loop through a [query][/query]'s
> returned values? I have this done using [query arrayref="myArray"] and then
> using $Tmp->{myArray} to fetch the ref inside [mvasp][/mvasp]...but i was
> wondering if there is a simpler way to do it? I cant avoid using [query]
> since I'm using pattern matching operator with MySQL.
> I just need the structure with a few hints on which commands would do the
> trick and I'll read in the doc...
> Something like:
> [query sql="..."][/query]
> [loop ???]
> My HTML here...along with [item ???]
> [/loop]

Maybe this isn't clear from the docs, but:

	[query list=1 sql="select * from whatever"]
		[sql-param field]

is what you want. I can't remember why that isn't the default.....

Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>

I don't buy from direct telephone or email marketers.  This makes it
hard for me to find a phone company. ;>