Hi all,
Im having problems with php database objects and difficulty with bindParam in particular.
The Following works fine.
[code=php]
$data = $this->DBH->query(“call insert_lead_details(‘fred’, ‘flinstone’, @response);”)->fetchAll(PDO::FETCH_ASSOC);
$total_count = $this->DBH->query(“select @response;”)->fetchAll(PDO::FETCH_ASSOC);
print_r($data);
echo ‘<br />’;
print_r($total_count);
But when I try using the following syntax i get nothing at all – no DB update and no error (or error code of 00000)
[code=php]
$stmt = $DBH->prepare(“call insert_lead_details(:visitorID,:firstname,:response);”);
$D1 = ‘fred’;
$D2 = ‘flinstone’;
$stmt->bindParam(“:visitorID”, $D1) ;
$stmt->bindParam(“:firstname”, $D2);
$stmt->bindParam(“:response”, $response , PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 50);
$stmt->execute();
print $response;
From the tuts I’ve read my syntax seems alright, I’ve tried with and without specifying the parameter type and length and im still stuck. Can anyone see what I’ve missed.
Thanks in advance!