Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Mar 2005
    Posts
    4
    Member #
    9359
    aranoid: i have a database of student in mysql now i want to implement
    search on different criterias like student age, marks, name, add,
    etc....
    I am exactly having a textbox named search on the form and whenever
    i enter any keyword in it it should find that keyword in to the
    whole database in all the fields and fetch me all the records without
    considering in which field of database the keyword is matching

  2.  

  3. #2
    Junior Member towerboy's Avatar
    Join Date
    Dec 2003
    Location
    Stevens Point, Wisconsin
    Posts
    28
    Member #
    4293
    You should be able to search by fields in the table. First off create a form that will allow searching. Make sure you use "$_POST[query]" for the value and the name should be "query". Then when you are making the output, use this:

    if ($_POST[query])
    $qStr = "(field name LIKE '%$_POST[query]%')";

    Obviously you can add more field names to it for each part you want it to seach with. Then use this for grabbing the information:

    $result = mysql_query("SELECT * FROM table name WHERE $qStr") or die ("Invalid query: SELECT");

    If you need this explained more, feel free to ask.
    :lick: I reject your reality and substitute my own.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com