I have a PHP loop.
Inside a loop I will have a Select statement.
I get error
Fatal error: Uncaught Error: Cannot pass parameter 2 by reference
I don't know what I am doing wrong.
This is my statement
<?php
$query = "SELECT customer.id AS customerid,customer.doc,
order.id AS orderid ,order.doc FROM customer
Inner Join order ON customer.doc = order.doc
Where customer.doc= ?";
if ($stmt = $mysqli->prepare($query)) {
$stmt->bind_param("i", 'DOC48599');
/* execute query */
$stmt->execute();
/* store result */
$stmt->store_result();
printf("Number of rows: %d.\n", $stmt->num_rows);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
And my second question is what is the best practice to have Select statement inside Loop.
So for each loop, it's going through; it will get an ID and do select statement binding the ID in the select statement.
Thanks