View Single Post
Old 09-30-2006, 08:44 AM  
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
And using Perl....

Code:
#!/usr/local/bin/perl

use DBI;
my $dbhost = 'localhost';
my $dbport = '3306';
my $dbuser = '';
my $dbpass = '';
my $db_name = '';
my $table_name = '';
my $outFile = 'output.csv';

$db_handle = DBI->connect("dbi:mysql:database=$db_name;host=$dbhost:$dbport;user=$dbuser;password=$dbpass")
    or die "Couldn't connect to database: $DBI::errstr\n";
$sql = "SELECT * FROM $table_name";
$statement = $db_handle->prepare($sql)
    or die "Couldn't prepare query '$sql': $DBI::errstr\n";
$statement->execute()
    or die "Couldn't execute query '$sql': $DBI::errstr\n";
open OUTPUT_FILE , ">$outFile";
while ($row_ref = $statement->fetchrow_hashref())
{
    print OUTPUT_FILE $row_ref->url .",".$row_ref->title ."$row_ref->description.",";
}
clode OUTPUT_FILE;
$db_handle->disconnect();
$13,000 please
PayPal Only
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202

Last edited by borked; 09-30-2006 at 08:46 AM..
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote