Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.