Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: SQL Database Table to Perl Script

by prithviraj (Novice)
on Oct 05, 2012 at 09:51 UTC ( #997422=note: print w/replies, xml ) Need Help??


in reply to Re^3: SQL Database Table to Perl Script
in thread SQL Database Table to Perl Script

Ok....This program:
#!/usr/bin/perl use DBI; use strict; use warnings; print "content-type:text/html\n\n"; my $dbh = DBI->connect('dbi:mysql:database:3306','prithvi','prithvi') +or die("Couldn't connect"); my $tran_cur = $dbh->prepare("SELECT AcNo, Type, SUM(Amount) FROM bank +tran GROUP BY AcNo, Type"); $tran_cur->execute; map {print "<td>$_</td>"}qw(Account Number-Type-Total Amount); print "<br/>"; while( my @data = $tran_cur->fetchrow_array) { my $rec = join ('-',@data); print "$rec<br/>"; } $tran_cur->finish; $dbh->disconnect;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997422]
help
Chatterbox?
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-06-25 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.