-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
getSqlQuery.php
25 lines (22 loc) · 944 Bytes
/
getSqlQuery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include_once 'setSqlQuery.php';
if(isset($sql)){
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr class='table-row' data-href='". $link_getSqlQuery_id . $row[$id_no] . "'><td name='name' id='name' class='text-right'>" . $row[$name] . "</td><td name='author' id='author' class='text-left'>" . $row[$author] . "</td></tr>";
}
}
}
else{
$sql = "SELECT $id_no, $name, $author FROM $table_name ORDER BY $author";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr class='table-row' data-href='". $link_getSqlQuery_id . $row[$id_no] . "'><td name='name' id='name' class='text-right'>" . $row[$name] . "</td><td name='author' id='author' class='text-left'>" . $row[$author] . "</td></tr>";
}
}
}
?>