|
|
| Mysql and Perl for the Web (ISBN: 0735710546) |
 |
List Price: $44.99
Our Price: $31.49
Used Price: $8.89
Release Date: 03 August, 2001
Manufacturer: New Riders Publishing (Paperback)
Sales Rank: 36,511
Author: Paul DuBois
|
More Info
|
|
|
DBI Mysql Select
|
2002-03-11 21:18:49
|
| |
perl
|
|
|
|
|
Category: source:perl:database
|
|
Description: Print all the rows from a mysql table using DBI to retrieve the data.
|
|
Platform: unix
|
|
Author: detour
|
|
Viewed: 4903
|
|
Rating: 4.3/5 (29 votes)
|
|
|
| If you have any questions about
this piece of code or still need help, try posting your question on the forum. |
#!/usr/bin/perl
#
# dbisel.pl written by detour@metalshell.com
#
# Print all the values from a mysql table using
# DBI to retrieve the data.
#
# http://www.metalshell.com/
#
use DBI;
$dbname = "mydatabase";
$user = "fred";
$pass = "secret123";
$table = "mytable";
my $db = DBI->connect("DBI:mysql:$dbname", $user, $pass);
$DBI::result = $db->prepare("select * from $table");
$DBI::result->execute();
while(@row = $DBI::result->fetchrow_array) {
print @row, "\n";
}
$db->disconnect;
|
|
|