Changed database access to PDO using prepared statements

This commit is contained in:
2023-02-22 10:50:24 +01:00
parent a4ecd1bff7
commit 7c300e0a8f
132 changed files with 5364 additions and 6091 deletions

View File

@@ -16,18 +16,16 @@ include("header.php");
// ************* <option value="0">{$lang_option_none}</option>
$query = "SELECT location_id, location_name, location_parent, location_sort
FROM location
ORDER BY location_parent, location_sort, location_name";
$sql = "SELECT location_id AS id, location_name, location_parent, location_sort
FROM location
ORDER BY location_parent, location_sort, location_name";
$sth = $dbh->query($sql);
$locations = $sth->fetchAll();
$locations = $db->db_select($query);
$location_counter = count($locations);
if ($location_counter>0) {
// get objects
if ($location_counter > 0) {
foreach ($locations AS $location) {
// create arrays
$location_names[$location['location_id']] = $location['location_name'];
$parents[$location['location_parent']][] = $location['location_id'];
}
@@ -36,7 +34,6 @@ if ($location_counter>0) {
// look for parents
// function to look for parents and create a new array for every child
function location($parents, $parent = 0) {
// loop array to check
foreach ($parents[$parent] as $child) {
if (isset($parents[$child])) {
// element has children
@@ -47,7 +44,6 @@ function location($parents, $parent = 0) {
}
}
// and again...
return $children;
}