Hi All
this is my first post here I have a problem with some code I am writing and have been trying to find the problem for a while any help would be very much appreciated,
I have a class for company and this method is supposed to return an associative array but as far as I can work out from dumping values etc I don't think the ? marks are being replaced by the parameters.
function readLike($page, $from_record_num, $records_per_page, $searchval){
$query = "SELECT
id, company_name, company_reg_number, vat_number, website
FROM
" . $this->table_name . "
where company_name like ?
ORDER BY
company_name ASC
LIMIT ?, ?;";
$stmt = $this->conn->prepare( $query );
$stmt->bindParam(1, $searchval, PDO::PARAM_STR);
$stmt->bindParam(2, $from_record_num, PDO::PARAM_STR);
$stmt->bindParam(3, $records_per_page, PDO::PARAM_STR);
$stmt->execute(array($searchval, $from_record_num,$records_per_page);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
return $result;
}
Thanks
Ross