I have form with a number of drop boxes which have the numbers 1-5 in them. I can use this code to populate a drop down but was wondering if I can somehow only make the call to
Simply get the results into an array using the fetch_all method. It returns all rows from the result set into an associative or numeric array. The you can do whatever you want with such array:
$result = $conn->query('SELECT * FROM riskNumDrop');
if (!$result) {
echo "query failed: (" . $mysqli->errno . ") " . $mysqli->error;
exit; // fetch_* functions cannot be called on error (sice $result is false)
}
// get all rows from the result
$rows = $result->fetch_all(MYSQLI_ASSOC);
// output first dropdown...
echo '';
// output second dropdown...
echo '';