<?php
    include_once("config.php");

    if(isset($_POST["szures"])){
        $felt = $_POST["szures"];

        $sql = "SELECT * FROM film order by cim";

        $result =  $conn->query($sql);
    
        if ($result->num_rows > 0){
            /*
            while ($row = $result->fetch_assoc()){
                echo $row["cim"]."<br>";
            }
            */
            echo "
            <table>
                <tr>
                <th>
                Ssz.
                </th>
                <th>
                Cím
                </th>
                <th>
                Ár
                </th>
                </tr>
            
            ";
    
            $counter = 1;
            while ($row = $result->fetch_object()){
                echo "<tr>
                        <td>".$counter."</td>".
                        "<td>".$row->cim."</td>".
                        "<td>".$row->jegyar."Ft </td></tr>";
                $counter++;
            }
    
            echo "</table>";
        } else {
            echo "Nincs adat";
        }
    }

    
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input>
</body>
</html>

<?php
    $conn->close();
?>