Backend óra_2024 12. 02.
This commit is contained in:
@@ -1,35 +1,54 @@
|
||||
<?php
|
||||
require_once("config.php");
|
||||
|
||||
if (isset($_POST["szures"])) {
|
||||
if (isset($_POST["cim"])) {
|
||||
$cim = $_POST["cim"];
|
||||
$tip = $_POST["tipus"];
|
||||
$ar = $_POST["jegyar"];
|
||||
|
||||
$felt = $_POST["szures"];
|
||||
$sql = "SELECT cim, jegyar FROM film WHERE cim LIKE '%".$felt."%' ORDER BY cim ";
|
||||
$parsql = "INSERT INTO film (cim, filmtipusID, jegyar) VALUES (?, ?, ?)";
|
||||
|
||||
$durr = $conn -> prepare($parsql);
|
||||
$durr -> bind_param("sii", $cim, $tip, $ar);
|
||||
|
||||
$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>";
|
||||
if ($durr -> execute() == true) {
|
||||
echo "<b>Sikeres adatbevitel<b>";
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
echo "Nincs adat";
|
||||
if (isset($_POST["szures"])) {
|
||||
$felt = $_POST["szures"];
|
||||
$sql = "SELECT cim, jegyar FROM film WHERE cim LIKE '%".$felt."%' ORDER BY cim ";
|
||||
$sqlparam = $conn -> prepare("SELECT cim, jegyar FROM film WHERE cim LIKE ? ORDER BY cim ");
|
||||
$sqlparam -> bind_param("s", $felt);
|
||||
$sqlparam -> execute();
|
||||
// $result = $conn -> query($sql);
|
||||
$result = $sqlparam -> get_result();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
require_once("html.php");
|
||||
$conn -> close()
|
||||
?>
|
||||
Reference in New Issue
Block a user