2007年3月18日 星期日

[Perl] 跟MySQL溝通




use DBI;



$dbh = DBI->connect('dbi:mysql:database=DM;host=140.113.55.66','5566','7788');

$sql = "select count(*) from `Games` Where `GameID`='55667788'";

$sth = $dbh->prepare($sql);

$sth->execute || die "Could not execute SQL statement ... maybe invalid? \n\n $sql \n";

#output database results

#while (@row=$sth->fetchrow_array){ print "@row\n" }

@row=$sth->fetchrow_array;

print "@row[1]\n";



沒有留言:

張貼留言