Declaración preparada: el número de variables no coincide con el número de parámetros en la declaración preparada
Sé que esta pregunta se ha hecho varias veces antes, pero no veo ningún problema con mi código y aún así aparece este error en mi código que no tiene ningún sentido.
arning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in line 131
Este es mi código completo:
if($stmt = $db_conx->prepare("SELECT id, product_name FROM yt ORDER by id") ) {
//die( $db_conx->error );
$product_list = "";
$stmt->bind_param("is", $id, $product_name);
if ( ! $stmt->execute() ) {
die( $stmt->error );
}
$stmt->bind_result($id, $product_name);
$stmt->store_result();
while($stmt->fetch()) {
$value[] = array('id'=>$id, 'product_name'=>$product_name);
$product_list .= "<li class='mix ".$product_name."' data-name='".$product_name."'><a href='../product_images/" . $id . "Image1.jpg'>
<img src='../product_images/" . $id . "Image1.jpg'></a>
<h4>".$product_name."</h4>
<br>
</li>
<div style='width:120px;'><a href='edit.php?edit=$id'>Edit this product</a></div>
<br>
<div style='width:120px;'><a href='products.php?delete=$id'>Delete this product</a></div>";
$files = glob('../cache/*'); // get all file names
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete file
}
}
}
mysqli_stmt_close($stmt);
Y esto es lo que hay en la Línea 131:
$stmt->bind_param("is", $id, $product_name);
¿hay algo que me estoy perdiendo?
Cualquier ayuda o consejo sería apreciado.
Gracias por adelantado.