Thursday, July 30, 2009

How to pull data from mysql table to an perl array ro hash for later display of the data in the perl?

I have a mysql database called ttf which has the table named donors, it contains first name, last name and donor id. I need to write a simple script on perl that can select a donors firstname, lastname and donor id and put it in to hash (array, now really sure) for later display use. for example print only the fist name from the data hash.


for example i need to put the output from this mysql command


select firstname, lastname,donorid from donors


so this could be stored at @data hash. so i could later on pull out the only first name from the hash and display it on the shell command line. I had a real trouble with this small script code, I'm new to both of the mysql and especially to perl. If anyone could help i would really apreciate that. Thank you.

How to pull data from mysql table to an perl array ro hash for later display of the data in the perl?
You will probably have better luck with that question in a newsgroup like perl.beginners, comp.lang.perl, or comp.lang.perl.misc.





If you don't have usenet access you can get it for about $15/year below.





If you use Linux you can access the newsgroups with Knode or Pan.





Also, head over to the bookstore with your computer and look for books like the Perl Cookbook. I have it upstairs but am about to log off and don't have time to check. You can often sit at the bookstore cafe with your computer and study from the programming cookbooks.


No comments:

Post a Comment