Backend/20241202/PHP adatbázis alapok-20241202/index.php

44 lines
828 B
PHP
Raw Permalink Normal View History

2024-12-02 13:36:30 +00:00
<?php
require_once('config.php');
if (isset($_POST["szures"]))
{
$felt = $_POST["szures"];
$sql = "Select cim,jegyar FROM film WHERE cim like '%".$felt."%' order by cim";
$result = $conn->query($sql);
if ($result->num_rows>0)
{
$i = 1;
echo "<table>
<tr><th>Ssz.</th>
<th>Cím</th>
<th>Ár</th>
</tr>";
while ($row = $result->fetch_object())
{
echo "<tr>
<td>".$i++."</td>
<td>".$row->cim."</td>
<td>".$row->jegyar."</td>
</tr>";
}
echo "</table>";
}
else
{
echo "Nincs adat";
}
}
require_once("html.php");
$conn->close();
?>