Nick19 Posted November 13, 2013 Share Posted November 13, 2013 (edited) 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, Edited November 13, 2013 by Nick19 Quote Link to comment https://forums.phpfreaks.com/topic/283873-php-search/ Share on other sites More sharing options...
Solution requinix Posted November 13, 2013 Solution Share Posted November 13, 2013 (edited) 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 Edited November 13, 2013 by requinix Quote 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:) Quote Link to comment https://forums.phpfreaks.com/topic/283873-php-search/#findComment-1458168 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.