The_Overdog has asked for the wisdom of the Perl Monks concerning the following question:
Query follows:
$query = "select id_code, title, author, html_hyperlink, entry_date, i +sbn, ddc, dewey_class, lcc,book_details, language, physical_descripti +on, discard_ind from books_main where $sort_by = '$id_code' order by +$sort_by";
Where variable $sort_by is one of the other fields listed above (isbn, id_code, etc).
My problem is with data display. When the query returns records from MS Access, the fields are not in the order selected above, and in fact are in different orders depending on the value of the where clause. IE if ISBN is selected, the fields are returned in different order than if AUTHOR is selected.
I am viewing the data via something like following:
Is there anything I can add to the query, or a different manner of output where the fields will appear in a consistent manner? This makes any field-specific manipulation post-query very difficult. Thanks.!$db->Sql($query) || Handle_Errors("$current_time couldn't do query: $ +query because " . $db->Error() ,1, $db->Error() . " $? $!",1); <p> while($db->FetchRow()) { @data = $db->DataHash(); $cycle_1 = $data[0];## physical desc field_name $cycle_2 = $data[1]; physical desc data $cycle_3 = $data[2];## language field name ###etc.....
Perl Version:
This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 33 registered patches, see perl -V for more detail)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI help - MS Access random field order
by afoken (Chancellor) on Feb 10, 2010 at 19:14 UTC | |
|
Re: DBI help - MS Access random field order
by Corion (Patriarch) on Feb 10, 2010 at 18:54 UTC |