I I am getting myself tangled with a pdo statement to display MySQL data in a table using pdo.
my syntax is:
$startdate=$_POST["start"];
$enddate=$_POST["end"];
$ttype=$_POST["ttype"];
$result = $db->query("SELECT cycletype,commenttype,adminstatus FROM v2loads where haulier= :haulier and :start < sarrive and :end> sarrive order by sarrive");
$result->bindParam(':haulier', $company, PDO::PARAM_STR);
$result->bindParam(':start', $startdate, PDO::PARAM_STR);
$result->bindParam(':end', $enddate, PDO::PARAM_STR);
$result->execute;
I then try t fetch the output with
<table>
<? while($row = $jobs->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td>
<? echo $row['cycletype'];?>
<td>
<td>
<? echo $row['icommenttype];?>
<td>
<td>
<? echo $row['adminstatus'];?>
<td>
</tr>
<? } ?>
</table>
This produces error:
Call to a member function bindParam() on a non-object
Any assistance would be appreciated.
Kind Regards,
This is your script:
Change This To:
Then Try:
You have used
bindparamon a non object..USEprepareinstead ofquery.