Results 1 to 4 of 4

Thread: Search

  1. #1
    Join Date
    Nov 2008
    Posts
    1

    Unanswered: Search

    I need to know if anyone knows how to search a database and sort out entries by name age etc

    for example:
    these three entries are entered into the table
    Alex-14
    Jim-15
    zach-19
    Aaron-15
    now say i wanted to search and be able to find all users that begin with the letter A. i would click the letter A then only Alex and Aaron would come up

    do you guys understand or do you need more info.

    Also i need to know a very simple way of making a private message system

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is this a SQL problem or an application problem

    at first glance the SQL is pretty trivial

    select my,column,list from mytable where mynamecolumn like "A$"

    an alternative would be
    select my,column,list from mytable where left(mynamecolumn,1,1) = "A"

    however youmention you want to click on a letter, so that means your problem also relates to how you access your data (the front end, the user interface), and yyou give no clues as to what front end you are usign
    it could be a web page a more traditional user interface (such as VB, VC, C#,.NET, Java)

    if its a web page then you may want to look at AJAX on a PHP script
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    healdem, mysql uses the standard percent sign as its wildcard character for LIKE, not the dollar sign



    Quote Originally Posted by banjax
    Also i need to know a very simple way of making a private message system
    you'll need three tables -- users, messages, recipients

    the users table contains one row for each user

    the messages table contains one row for each message, with a foreign key to the user who sent it

    the recipients table contains one row for each recipient of each message, with foreign keys to the message and to the user who is the recipient

    that should get you started

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    oops my bad....

    sorry the $ was a typo, as ignorant as I am in SQL,even I knew % is the MySQL wildcard
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •