Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $('#search').keyup(function(){
- var sea = $('#search').val();
- $.get('test.php',{getsearch:sea},function(data){
- $('#result').show().html(data);
- });
- });
- $('#search').blur(function(){
- $('#result').hide();
- });
- });
- </script>
- </head>
- <body>
- <div class="cover">
- <div class="btns-holder">
- <input type="search" name="s" placeholder="Search for something.." id="search" autocomplete="off" /><input type="submit" name="sub" value="" id="sub" />
- </div>
- </div>
- <div id="result">
- </div>
- <?php
- $post = @$_GET['p'];
- $que = "SELECT * FROM `search` WHERE `id`='$post'";
- $run = mysqli_query($con,$que);
- while($row=mysqli_fetch_array($con,$que)):
- ?>
- <img src="<?php echo $row['image']; ?>" widrh="500px" height="450px" style="float: left;"></img>
- <h2 style="font-family: sans-serif;"><?php echo $row['title']; ?></h2>
- <?php endwhile; ?>
- </body>
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "";
- $db = "ajax_search";
- $con = mysqli_connect($host, $user, $pass, $db);
- if(mysqli_connect_errno())
- {
- echo "connection failed".mysqli_connect_error();
- }
- $search = @$_GET['getsearch'];
- $que = "SELECT * FROM `search` WHERE `title` LIKE '%$search%'";
- $run = mysqli_query($con,$que);
- while($row=mysqli_fetch_assoc($run)):
- ?>
- <a href="search.php?p=<?php echo $row['id']; ?>">
- <div class="container">
- <img src="<?php echo $row['image']; ?>" width="50px" height="45px"></img>
- <h3><?php echo $row['title']; ?></h3></br>
- </div>
- </a>
- <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement