I'm having trouble creating a mysql query based on checkbox.
1. I have a form based on a select that contains a checkbox for line
<input type="checkbox" name="check[]" value="<?php echo $linhas['id'];?>" >
2. I make an implode to get the "id"
$check_id = implode(',', $_POST["check"]);
3. $ check_id var_dump results in the "id" I want (clicked)
var_dump($check_id)."<br>"; // retorno do var_dump é string(3) "1,3"
4. finally I would like to create a query to display the data with based on the selected "id."
$comprado = mysqli_query($conn, "
SELECT pedidos.id as id_comprado, qtde
FROM pedidos
WHERE id_comprado = '$check_id'
");
5. These are the errors displayed
Warning: mysqli_num_rows () expects parameter 1 to be mysqli_result, boolean given in xxx on line 108
My line 108 is $comprados = mysqli_num_rows($comprado);
Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given in xxx on line 132
My line 132 starts with while($comprados = mysqli_fetch_array($comprado)){...