dziennik-backend/public_html/uwagi.php
2022-02-01 09:00:34 +01:00

57 lines
1.0 KiB
PHP

<?php header('Access-Control-Allow-Origin: *'); ?>
<!DOCTYPE html>
<html>
<head>
<style>
table {
<body style="background-color:powderblue;">
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = intval($_GET['q']);
$con = mysqli_connect('mysql49.mydevil.net','m1344_dziennik','Julian2020!','m1344_dziennik');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"ajax_demo");
$sql = "SELECT a1.firstName as imie, a1.surName as nazwisko, u1.tresc as tresc FROM accounts as a1\n"
. "LEFT JOIN uwagi as u1 ON a1.id_account = u1.id_account";
$result = mysqli_query($con,$sql);
echo "<table>
<tr>
<th>Treść</th>
<th>Nazwisko</th>
<th>Treść></th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['imie'] . "</td>";
echo "<td>" . $row['nazwisko'] . "</td>";
echo "<td>" . $row['tresc'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</body>
</html>