Hi,
I need (well don't need but would like) to use FETCHALL_ARRAYREF to select rows from mysql but I need the end result to be a hash because I need key names rather than numbers for my template parser, eg <%Foo%> not <%1%>. So I guess this is not the way to go.
Would anyone like to provide some code that will use FETCHROW_HASHREF but return the data as a hash :)
The query is.... SELECT * FROM Table ORDER BY Foo ASC LIMIT 0,25
Is it possible to use dereferencing?
If I had:
ColA, ColB, ColC
Row1, Row2, Row3
....I'm guessing the hashref would look like:
$hash = {
Row1 => { ColA, ColB, ColC },
Row2 => { ColA, ColB, ColC },
Row3 => { ColA, ColB, ColC },
};
Is that close?...that makes me think I can't use a normal hash for this.
Thanks!
I need (well don't need but would like) to use FETCHALL_ARRAYREF to select rows from mysql but I need the end result to be a hash because I need key names rather than numbers for my template parser, eg <%Foo%> not <%1%>. So I guess this is not the way to go.
Would anyone like to provide some code that will use FETCHROW_HASHREF but return the data as a hash :)
The query is.... SELECT * FROM Table ORDER BY Foo ASC LIMIT 0,25
Is it possible to use dereferencing?
If I had:
ColA, ColB, ColC
Row1, Row2, Row3
....I'm guessing the hashref would look like:
$hash = {
Row1 => { ColA, ColB, ColC },
Row2 => { ColA, ColB, ColC },
Row3 => { ColA, ColB, ColC },
};
Is that close?...that makes me think I can't use a normal hash for this.
Thanks!