Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "schop";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- if (isset($_POST['submit'])) {
- $sql = "INSERT INTO prekes (name, price, description) VALUES ('".$_POST['name']."','".$_POST['price']."','".$_POST['description']."')";
- mysqli_query($conn, $sql);
- }
- if (isset($_GET['delete'])) {
- $sql = "DELETE FROM prekes WHERE id= ".$_GET['delete'];
- mysqli_query($conn, $sql);
- }
- $sql = "SELECT * FROM prekes order by id asc";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0)
- // output data of each row
- mysqli_close($conn);
- include"wiev.php";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement