iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2008, 12:45 PM
flhu's Avatar
WebProWorld Member
 
Join Date: May 2008
Location: NY
Posts: 97
flhu RepRank 2
Default MySQL results into Perl Hashes?

I wrote a product/item/blog/calendar search engine in Perl that used flat files.
It worked really good for the < 200 items I usually have to deal with. But then, when it was about 3000, it started getting slow, but still pretty good.

Now I'm looking at adding about 12,000 items, and it obviously is going to need mySQL.

I don't want to rewrite everything... at least not this week.

I only started using/learning DBI and MySQL yesterday, so my brain is pretty fried.
(and I've already converted the data into a MySQL table.)

after preparing and executing the query (which does run properly. I can get an array of an array of results, but that doesn't help me without the name of the columns)...

Code:
$stb = $DB->prepare("select * from datatable where $items regexp ? ");
$stb->execute(($regc));

the following code was in a tutorial, and it says it's supposed to work...

Code:
my %trow = map { $_->[1], $_->[2]} @{$stb->fetchall_arrayref({})};
foreach my $tr (keys (%trow)){
    print "Hash $tr: $trow{$tr}\n";
        }
...but alas, no.

Any suggestions on getting the results into a hash o' hashes?
ie: $results{$item_num}->{$field}


And I am still looking for a MySQL/DBI tutorial that progresses in difficulty in a reasonable manner. How come most tutorials' chapter 1 covers "What is a Database?" and Chapter 2 covers advanced coding with the assumption that the reader has at least a masters in computer science?

Thanks!
__________________
I liken SEO to voodoo and make a sacrifice of rum and decapitate a chicken to Papa Legba, spirit of communications and crossroads, before every site launch.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PERL pass "Perl" crash TrafficProducer Web Programming Discussion Forum 0 09-02-2007 03:07 PM
Perl, CGI and SSI dak888 Web Programming Discussion Forum 2 02-27-2007 12:16 PM
I've been told that my Perl, CGI, MYSQL site is obsolete ericjw Web Programming Discussion Forum 23 12-06-2006 11:41 AM
PHP displaying mysql results DarrenPWS Web Programming Discussion Forum 1 02-18-2005 01:13 PM
perl pagetta Web Programming Discussion Forum 2 02-16-2005 06:26 PM


All times are GMT -4. The time now is 08:23 PM.



Search Engine Optimization by vBSEO 3.3.0