Changed database access to PDO using prepared statements
This commit is contained in:
21
subnet.php
21
subnet.php
@@ -10,24 +10,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
$query = "SELECT
|
||||
s.subnet_id,
|
||||
s.subnet_address,
|
||||
s.subnet_mask,
|
||||
s.ntp_server,
|
||||
LEFT(s.subnet_info, 40) AS subnet_info,
|
||||
$sql = "SELECT s.subnet_id, s.subnet_address, s.subnet_mask,
|
||||
s.ntp_server, LEFT(s.subnet_info, 40) AS subnet_info,
|
||||
CHAR_LENGTH(s.subnet_info) AS subnet_length,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet AS s LEFT JOIN node USING (subnet_id)
|
||||
GROUP BY
|
||||
s.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(s.subnet_address)";
|
||||
FROM subnet AS s LEFT JOIN node USING (subnet_id)
|
||||
GROUP BY s.subnet_id
|
||||
ORDER BY INET_ATON(s.subnet_address)";
|
||||
$sth = $dbh->query($sql);
|
||||
|
||||
$subnets = $db->db_select($query);
|
||||
$smarty->assign("subnets", $sth->fetchAll());
|
||||
|
||||
$smarty->assign("subnets", $subnets);
|
||||
$smarty->display("subnet.tpl");
|
||||
|
||||
include("footer.php");
|
||||
|
||||
Reference in New Issue
Block a user