I'm trying to pull a record set and I'd like to load the data into an array
It loops through and I see it going through all the data correctly, but when I try to assign it to an array using $i - it just keeps replacing it, it doesn't add a new value to the array.
Thanks in advance!!
$index = "";
$service_singular = "";
$service_plural= "";
$sub_service = "";
$description = "";
$duration = "";
$duration_descript = "";
$price = "";
$i = 0;
if ($fac_id != "" && $fac_id != 0){
if ($stmt = $mysqli->prepare("SELECT `index`,`service_singular`, `service_plural`, `sub_service`, `description`, `duration`, `duration_descript`, `price` FROM `service` WHERE `fac_id`= ?")) {
$stmt->bind_param('s', $fac_id); // Bind "fac_id" to parameter.
$stmt->execute(); // Execute the prepared query.
$stmt->store_result();
// $i = $stmt->num_rows;
$stmt->bind_result($index,$service_singular, $service_plural, $sub_service, $description, $duration, $duration_descript, $price); // get variables from result.
while ($stmt->fetch()){
$i = $i++; }
}
