Skip to content

Instantly share code, notes, and snippets.

@jxpsert
Created May 20, 2022 07:13
Show Gist options
  • Select an option

  • Save jxpsert/59e72fb28543089d9a6ad663476f8623 to your computer and use it in GitHub Desktop.

Select an option

Save jxpsert/59e72fb28543089d9a6ad663476f8623 to your computer and use it in GitHub Desktop.
functie getAllRubrics
/*
Returns all rubrics as an array.
*/
function getAllRubrics() {
global $conn;
$sql = "SELECT * FROM rubriek ORDER BY rubriek, rubrieknaam ASC";
$stmt = sqlsrv_query($conn, $sql);
$newArr = [];
while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
$arr = [];
$arr['id'] = $row['rubrieknummer'];
$arr['name'] = utf8_encode($row['rubrieknaam']);
$arr['parentid'] = $row['rubriek'];
array_push($newArr, $arr);
}
return $newArr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment