J
JimJx
Hi all,
I am trying to access a DB using a select statement and am having a
little problem.....
I connect fine, but I just can't seem to pull any data out. The
script I am using is below...
I know it is running the script because it is printing out the ToEdit:
$ToEdit
Any suggestions greatly appreciated.
Jim
if ($Enter) {
my $dbh = DBI->connect('DBI:mysql:farthing_valleyweb',$DBuser,
$DBpass)
or die "Couldn't connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('SELECT * FROM valley WHERE Name LIKE "%$ToEdit
%"') or die "Cannot prepare: " . $dbh->errstr();
$sth->execute()
or die "Couldn't execute statement: " . $sth->errstr;
while ($thisvalue = $sth->fetchrow()) {
push @thisarray, $thisvalue;
};
$dbh->disconnect;
foreach (@thisarray) {
print @thisarray . "<br />";
}
print "ToEdit: $ToEdit\n";
exit;
}
I am trying to access a DB using a select statement and am having a
little problem.....
I connect fine, but I just can't seem to pull any data out. The
script I am using is below...
I know it is running the script because it is printing out the ToEdit:
$ToEdit
Any suggestions greatly appreciated.
Jim
if ($Enter) {
my $dbh = DBI->connect('DBI:mysql:farthing_valleyweb',$DBuser,
$DBpass)
or die "Couldn't connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('SELECT * FROM valley WHERE Name LIKE "%$ToEdit
%"') or die "Cannot prepare: " . $dbh->errstr();
$sth->execute()
or die "Couldn't execute statement: " . $sth->errstr;
while ($thisvalue = $sth->fetchrow()) {
push @thisarray, $thisvalue;
};
$dbh->disconnect;
foreach (@thisarray) {
print @thisarray . "<br />";
}
print "ToEdit: $ToEdit\n";
exit;
}