Nick19 Posted November 13, 2013 Share Posted November 13, 2013 Okay so i have created a php search script that selects the users user-name from the database when you search for it, but i want it to list all users and want the search box at the top, when a user is searched i want all the users to hide and only want the one user searched for to display.. eg.. <!-- Searchbox --> < when a user is searched for eg user 1 i want user 2 and 3 to go and only user 1 to stay. <!-- List all users --> user1 user2 user3 <-- End --> the code i have... test.php file <?php session_start(); require "config.php"; if (isset($_POST ['name'])) { $result=@mysql_query("SELECT * FROM users WHERE user='" . $_POST['name'] . "'"); $row =@mysql_fetch_array($result); echo $row['user']; echo "<br>"; } ?> <table> Find a User: <form name="form1" method="post" action="test.php"> <input name="name" type="text" id="name" /> <input type="submit" name="Submit2" value="Find" /> </form> </table> any suggestions on how to do this? thanks, Link to comment https://forums.phpfreaks.com/topic/283873-php-search/ Share on other sites More sharing options...
requinix Posted November 13, 2013 Share Posted November 13, 2013 if the person is searching for a user { grab all the users that match that search, with or without pagination } else { grab all the users, with or without pagination } display those users Link to comment https://forums.phpfreaks.com/topic/283873-php-search/#findComment-1458165 Share on other sites More sharing options...
Nick19 Posted November 13, 2013 Author Share Posted November 13, 2013 well that was simple haha, thankyou:) Link to comment https://forums.phpfreaks.com/topic/283873-php-search/#findComment-1458168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.