added
This commit is contained in:
parent
8b8e8f2ad4
commit
0b28a908b1
|
@ -56,7 +56,7 @@
|
|||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<input>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
15
20241202/PHP adatbázis alapok-20241202/config.php
Normal file
15
20241202/PHP adatbázis alapok-20241202/config.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
$server = "localhost";
|
||||
$user = "root";
|
||||
$pwd = "";
|
||||
$db = "13b2";
|
||||
|
||||
$conn = new mysqli($server,$user,$pwd,$db);
|
||||
|
||||
if ($conn->connect_errno)
|
||||
{
|
||||
die("Nem sikerült a kapcsolat kiépítése: ".$conn->connect_error);
|
||||
}
|
||||
|
||||
?>
|
14
20241202/PHP adatbázis alapok-20241202/html.php
Normal file
14
20241202/PHP adatbázis alapok-20241202/html.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="hu">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Szűrés</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="POST">
|
||||
<input type="text" name="szures">
|
||||
<button type="submit">Szűrés</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
44
20241202/PHP adatbázis alapok-20241202/index.php
Normal file
44
20241202/PHP adatbázis alapok-20241202/index.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?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();
|
||||
?>
|
2847
20241202/PHP adatbázis alapok-20241202/mozi.sql
Normal file
2847
20241202/PHP adatbázis alapok-20241202/mozi.sql
Normal file
File diff suppressed because it is too large
Load Diff
15
20241202/enyem/config.php
Normal file
15
20241202/enyem/config.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
$server = "localhost";
|
||||
$user = "root";
|
||||
$pwd = "";
|
||||
$db = "13b2";
|
||||
|
||||
$conn = new mysqli($server,$user,$pwd,$db);
|
||||
|
||||
if ($conn->connect_errno)
|
||||
{
|
||||
die("Nem sikerült a kapcsolat kiépítése: ".$conn->connect_error);
|
||||
}
|
||||
|
||||
?>
|
21
20241202/enyem/html.php
Normal file
21
20241202/enyem/html.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="hu">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Szűrés</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="POST">
|
||||
<input type="text" name="szures">
|
||||
<button type="submit">Szűrés</button>
|
||||
</form>
|
||||
<h2>ADAT felvétel</h2>
|
||||
<form method="POST">
|
||||
Cím: <input type="text" name="cim"><br>
|
||||
Filmtípus: <input type="number" name="tipus"><br>
|
||||
Jegyár: <input type="number" name="ar"><br>
|
||||
<button type="submit">KÜLD</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
65
20241202/enyem/index.php
Normal file
65
20241202/enyem/index.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
require_once('config.php');
|
||||
|
||||
if (isset($_POST["cim"])){
|
||||
$cim = $_POST["cim"];
|
||||
$tip = $_POST["tipus"];
|
||||
$ar = $_POST["ar"];
|
||||
|
||||
$parsql = "INSERT INTO film (cim, filmtipusID, jegyar)
|
||||
VALUES (?,?,?)";
|
||||
|
||||
$durr = $conn->prepare($parsql);
|
||||
$durr->bind_param("sii", $cim, $tip, $ar);
|
||||
if ($durr->execute()==true){
|
||||
echo '<b>sikeres feltöltés</b>';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST["szures"]))
|
||||
{
|
||||
|
||||
$felt = $_POST["szures"];
|
||||
$sql = "Select cim,jegyar FROM film WHERE cim like '%".$felt."%' order by cim";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
|
||||
//paraméteres sql lekérdezés
|
||||
$felt = "'%.$felt.%'";
|
||||
$sqlparam = $conn->prepare("Select cim,jegyar FROM film WHERE cim like ? order by cim");
|
||||
$sqlparam->bind_param("s", $felt);
|
||||
$sqlparam->execute();
|
||||
$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();
|
||||
?>
|
2847
20241202/enyem/mozi.sql
Normal file
2847
20241202/enyem/mozi.sql
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user