Skip to content

Instantly share code, notes, and snippets.

@supernovaplus
Last active June 12, 2020 17:05
Show Gist options
  • Save supernovaplus/16b815b4df41a1bd0e619fae71015ce0 to your computer and use it in GitHub Desktop.
Save supernovaplus/16b815b4df41a1bd0e619fae71015ce0 to your computer and use it in GitHub Desktop.
<?php
//case(3): array_push($fetch_array, [&$response->vouchers,"select * from vouchers_config;"]); break;
function fetchdb($data){
global $response, $conn;
$query = "";
for ($i=0; $i < count($data); $i++) {
$query .= $data[$i][1];
}
if (mysqli_multi_query($conn, $query)) {
$column = 0;
do {
$data[$column][0] = [];
if ($result = mysqli_store_result($conn)) {
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
array_push($data[$column][0], $row);
}
mysqli_free_result($result);
$column++;
}
} while (mysqli_next_result($conn));
}
}
fetchdb($fetch_array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment