Jump to content

search help


banjax

Recommended Posts

ok i had no idea how or if i can edit my post but what i need basically is this http://www.phpfreaks.com/forums/index.php/topic,224589.0.html

 

where users can search for other users by the first letter of there user name,Age,Position Etc

 

www.FSAgency.net this is my site if you click on ad's you will see one database entry in there. that is where i need it to be able to search

Link to comment
https://forums.phpfreaks.com/topic/132425-search-help/#findComment-688547
Share on other sites

Yes, you can use a wildcard then order_by the field.  For example if you want to grab the letter that was entered in the field by the user then you would probably do a post and put in in the query.  Then you can have and ORDER BY clause.

 

$letter = $_POST['user_letter_search'];
$result = mysql_query("SELECT * FROM table_name WHERE name LIKE '{$letter}%' ORDER BY name ASC") 
or die(mysql_error());  

 

If you want the user to toggle between ascending/descending then I would probably just make the "ASC" a variable.

Link to comment
https://forums.phpfreaks.com/topic/132425-search-help/#findComment-688729
Share on other sites

It depends.  If you just want simple example with a field and a query, not very long.  I already gave you the PHP/MySQL part now all you have to do is create a basic HTML form with an input field for the letter the user wants to search.  Let me know if you need help, please provide code before asking for it.

Link to comment
https://forums.phpfreaks.com/topic/132425-search-help/#findComment-688933
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.