I'm hoping for some conceptual help here....
I have tried to find references to my question without
success ( the list-archive link appears not to be working).

System info: Linux - Perl - MySql

I'm fairly comfortable at this stage with H::T,
and am also fairly comfortable with the DBI/MySql
interface.

I have a script that queries the database, and pulls
information from numerous records ... in other words,
it grabs and displays all the record information
for a selected group of records.

I can get the results to print directly with this code:

$sth = $dbh->prepare ("SELECT * FROM $working_tbl WHERE first='one' ORDER BY Location");
$sth->execute ();
while ( my $hash_ref = $sth->fetchrow_hashref ) {
print "ID: $hash_ref->{'ID'} -- Name: $hash_ref->{'Name'} (etc....) <br>\n";
}


And before I became an H::T convert, I would use
the above approach, and craft the HTML output
directly in the script.

Now that I am an H::T convert, I'm looking for guidance
on how best to handle the database output so I can
take advantage of the <TMPL_LOOP> feature in H::T

I tried googling, and did find a few references on this topic,
but I had difficulty understanding them. I'm no wizard when
it comes to the object oriented side of things, or MySql
retrievals in general.

I have found that (for me) retrieving data using fetchrow_hashref
is easier 'cause the info can be gleaned using the field names,
where (it seems to me), fetchrow_array is based on the numerical
order/array-reference of the items, and is easier for me to screw up.

At any rate, I think I'm close to understanding it, but am hoping
someone can explain the process in a pretty basic way. I think
I understand the fundamentals, but am really struggling
trying to understand how the info gets tossed into some
sort of container so it can be sent out to a <TEMPL_LOOP>
call in the related template.


Carl Hagstrom






-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to