+ Reply to Thread
Results 1 to 5 of 5

Thread: search database with php

  1. #1
    niahossain is offline x10Hosting Member niahossain is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    16

    search database with php

    this page http://www.bdinfo.exofire.net/bds.html containes 2 search forms. i want them to search an access database. Someone told me that I should put the form action as, form action="search.php". But then I don't what to write in search.php. Can someone please guide me on how to go about it ? I don't know php, except for the basic things that I've picked up reading tutorials. However, I'm not a slow learner, if someone would give me the steps I should follow and a template or a sample php file that searches a database, I'm sure I can do it.

    From what I've gathered so far, the first thing I'm supposed to make a connection to my database in the search.php...I don't know how to do this, and neither do I kno what to do afterwards. I need this done within a day or 2, please help me !

  2. #2
    ShannenName is offline x10Hosting Member ShannenName is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    5

    Re: search database with php

    Code:
    mysql_connect('localhost', 'mysql_user', 'mysql_password');
    To make the connection to the database then the basic code should be
    Code:
    mysql_query("SELECT * FROM table WHERE table_name LIKE ('%{$_GET['search_name']}%')",$c);
    As for the actual search page put this somewhere.
    Code:
    <form action='search.php' method='get'><input type='text' name='search_name' /><br /><input type='submit' value='Search' /></form>

  3. #3
    niahossain is offline x10Hosting Member niahossain is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    16

    Re: search database with php

    thank you ! but i keep reading abouy MySQL, but i don't how to use that. I read that php can also connect to databases made with MS Access. Is that true ? If so, how will I make the connection ??

    And in my form, there are no textboxes, but pulldown menus ? this is the html code of my form :

    Code:
     <form method="POST" action="search.php">  
    <p>
      <select size="1" name="D1">
      <option>Almas</option>
      <option>Nandan</option>
      <option>Etc</option>
      </select><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    so where do i put in, name="search_name" ???

  4. #4
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: search database with php

    D1 would be your search name then

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  5. #5
    niahossain is offline x10Hosting Member niahossain is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    16

    Re: search database with php

    thank u so so much, I'll try it out

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  3. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM
  4. PHP BB 2.0.16 Manual instalation
    By GFIV in forum Free Hosting
    Replies: 8
    Last Post: 09-14-2005, 12:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers