The following code works just fine: $sth = $dbh->prepare(qq(select count(*) from discounts where min_value < ?)); $sth->bind_param( 1, 5, SQL_INTEGER); $sth->execute();
The actual query my application uses is much longer and the rest of the values in the where clause are varchar's. Is there a way to assign the data type by column, then doing the execute with the value? Something like this: $sth = $dbh->prepare(qq(select count(*) from discounts where min_value < ?)); $sth->bind_param(1, SQL_INTEGER); $sth->execute(5); This would help too if the execute is in a loop. like this... $sth = $dbh->prepare(qq(select count(*) from discounts where min_value < ? and code=?)); $sth->bind_param(1, SQL_INTEGER); foreach (@( $myArrayHash) ){ $sth->execute($myArrayHash{'min'},$myArrayHash{'code'}); .... } Any thoughts?