Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $host = 'localhost';
- $user = '111042';
- $password = 'jcbvrjd8';
- $db_name = '111042';
- $search = $_POST["search"];
- if(isset($search)) {
- $db = mysqli_connect($host, $user, $password, $db_name);
- $wild_search = "%".$search."%";
- $findname = "SELECT `name`,`surname`
- FROM `Account`
- WHERE `name` LIKE '".$wild_search."'
- OR `surname` LIKE '".$wild_search."'
- OR CONCAT(`name`, `surname`) LIKE '".$wild_search."'
- OR CONCAT(`name`, `surnameprefix`, `surname`) LIKE '".$wild_search."';";
- $query = mysqli_query($db,$findname);
- $results = mysqli_fetch_all($query);
- if($result) {
- echo "<div id='searchresult'>n";
- echo "<h1>People Found:</h1>n";
- echo "<table id='searchresult'>n";
- foreach($result as $rowno => $row) {
- echo "<tr class='searchtablerow'>n";
- echo "<td>".$row['name'].", ".$row['surname']."</td>n";
- echo "</tr>n";
- }
- echo "</table>n";
- } else {
- echo "<div id='searchresult'><h1>People Found:</h1>n";
- echo "<p>No one was found...</p>n";
- echo "</div>n";
- }
- } else {
- }
- <div id="searchform">
- <h1>Search friends:</h1>
- <form name="searchform" method="post" action ="searchlink.php">
- <input type="text" name="search" id="search" autofocus placeholder="e.g. John Smith..."></input> <br>
- <input type="submit" name="submitsearch" value="Search" id="searchbutton"></input>
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement