Re: [htmltmpl] "dump"-ing a loop
Brought to you by:
samtregar
From: Puneet K. <pk...@ei...> - 2003-08-12 12:36:30
|
On Tuesday, August 12, 2003, at 12:42 AM, Kenneth Gonsalves wrote: > On Tuesday 12 August 2003 09:45, you wrote: >> did a few "feeble" searches in the archive, but I really don't know >> how >> to word this exactly... >> >> I want to query a database table, and then print the results. The >> problem is, I don't know what the names of the fields are... >> >> so, while I can build an array of hash refs from the returned results, >> and assign them to a tmpl_loop, I don't know the names of the >> tmpl_vars... so in my template, I don't really know what to print out. > you have an anonymous array/hash. you dont need to know the names of > the > variables. assign something like: > $var1 = @$return[0]. $var2 = @$return[1] etc (do this in the code and > not in > the template) > kg > won't really work, I think. See, I query the database table like so (I have to, not that I want to)... SELECT * FROM mytable WHERE somecondition so in advance I have no idea how many fields are returned, and what their names are. While I can find that out in my code using the capabilities of my database driver module, I can't really rewrite my template on the fly (unless that is one way of doing it). Hence, I am stuck... |