Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect("localhost","root","") or die('db connection failed');
- mysql_select_db("cenima") or die('db connection failed');
- $output='';
- //collect
- if(isset($_POST['search'])){
- $search=$_POST['search'];
- $Search= preg_replace("#[^0-9a-z]#i","",$search);
- $query=mysql_query("SELECT * FROM users WHERE FIRSTNAME IS LIKE '%$search%' or lastname is LIKE '%$search%'") or die("could not search");
- $count=mysql_num_rows($query);
- if($count==0){
- $output = 'there was no search result';
- }else{
- while($row=mysql_fetch_array($query)){
- $emil=$row['email'];
- $uname=$row['user_name'];
- $id=$row['ic'];
- $output = '$email.$uname';
- }
- }
- }
- ?>
- <html>
- <head>
- <style>
- </style>
- <body>
- <form action="index.php" method="post">
- <input type="text" placeholder="please write somthing here" name="search">
- <input type="submit" value=">>" />
- </form>
- <?php print("$output"); ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement