Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $db = "artikel";
- $conn = new mysqli($servername, $username, $password, $db);
- $search = '';
- if (array_key_exists('search', $_GET)) {
- $search = $_GET['search'];
- $sql = "SELECT * FROM artikel WHERE * LIKE '%" . $search . "%'";
- $result = mysql_query($sql);
- // var_dump($result);
- if ($result->num_rows > 0) {
- while ($row = mysql_fetch_object($result)) {
- echo $row->prijs;
- echo $row->artikelnaam;
- }
- } else {
- echo "niets gevonden";
- }
- }
- mysql_free_result($result);
- $conn->close();
- ?>
- <form method="get" action="">
- <input id="search" name="search" type="text" placeholder="search">
- <input type="submit" name="submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement