sure there aren't any scope issues?

-----Original Message-----
From: Krung Saengpole [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 2:07 PM
To: [EMAIL PROTECTED]
Subject: SQL statement.


Hi all,

I have one problem that should not be. I use Access97 on NT server with
IIS5. I couldn't use placeholder in SQL statement as below:

use DBI;
$dbh = DBI->connect("dbi:ODBC:myDSN",'','');
$sql = "Select * From myTable Where ID_Code = ?";
$sth = $dbh->prepare($sql);
...
$sth->execute($ID_code);  #ID_code contains ID_Code value
$rc = $sth->fetchrow_hashref;
print $rc->{'FIELD_NAME'}; # no result

I have to change $sql to "Select * From myTable Where ID_Code=$ID_code" and
call $sth->execute() instead to fetch the result to $rc. What's wrong with
my code?

Any advices would be greatly appreciated.
Krung.

Reply via email to