I am currently struggling to convert my SQL query statements to Prepared Statement. I hope I'll be able to receive some help.
There are 2 which I need to convert to Prepared Statement:
$query = "SELECT DISTINCT catename FROM catetable";
$queryStatement = mysqli_query($connection, $query);
<select name="bsearch" id="bsearch">
<?php while ($one_model= mysqli_fetch_assoc($queryStatement) ) { ?>
<option value="<?php echo $one_model['catename']; ?>">
<?php echo $one_model['catename']; ?>
</option>
and also
$filter = "";
if(isset($_POST['bsearch']))
{
$mod_selected = $_POST['bsearch'];
$filter = " WHERE catename ='$mod_selected'";
}
$sql = "SELECT a.name, a.picture, b.catename, a.description, a.price, a.id FROM bikeproduct a INNER JOIN catetable b ON a.cid = b.cateid". $filter;
$bike_list = mysqli_query($connection,$sql);
How will I be able to change create a bind_param for the second code? It'll be nice to have some explanations too. Thank you.