On Thu, 14 Jun 2001 04:07:14 +0700, Krung   Saengpole wrote:

>$sql = "Select * From myTable Where ID_Code = ?";
>$sth = $dbh->prepare($sql);
>...
>$sth->execute($ID_code);  #ID_code contains ID_Code value

>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?

I don't see anywhere that you tell the db that your placeholder is
numeric. Under the prepare statement, do:

        $sth->bind_param(1, undef, SQL_INTEGER);

You need to have these constants, by loading DBI as such:

        use DBI ':sql_types';

Also, have you set PrintError and/or RaiseError to true? That would help
in debugging.

-- 
        Bart.

Reply via email to