Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    17

    Smile Unanswered: Doing Queries in webpages

    Alright, well lets see where to start.

    I have a MS-Access Database which I converted to SQL. I am going to be using PHP to create a sort of search box.

    Let's say I have the following database- (Its of Fish sorted by Family, Genus and Species)

    Family | Genus | Species| Col4 |Col5 (This Database isn't to scale [real one is over 20 columns])

    I want to make a webpage that acts as a search of this database

    IE

    A drop down box with the possibilities from [Family]

    A drop down box with the options of [Genus] from the selection chosen from Family

    A Drop down box with the options of [Species] from the selection chosen from Family

    After Family is selected, I want the corresponding data from Col4 and Col5.. and so on formatted below the box.

    I also have a set of pictures that I would like to correspond to the species selected.

    I am not really code illiterate, but I am PHP illiterate. Any help would be appreciated.

  2. #2
    Join Date
    Jun 2004
    Posts
    17
    This is the code i got so far:

    Code:
           $db = mysql_connect ("localhost", "NAME", "PW") 
            or die ("Error while connecting to database: ".mysql_error());
          mysql_select_db("test"); 
    
          print("<select name=\"family\">\n");
          $query = "SELECT * FROM Master"
          $result = mysql_query($query, $db)
            or die ("Error while accessing database: ".mysql_error());
          for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { 
            if(!($row = mysql_fetch_object($result)))
              continue;
            print("<option>".$row->Family."\n");

  3. #3
    Join Date
    Jun 2004
    Posts
    11
    what I would do to start would be export all tables from ms acess as csv and import them into mysql

    and to search the way you want it would take a lot of work, depending on how many different categories there are

    I have an idea for how to do it but i'm not going to type it all out unless you're interested...let me know

  4. #4
    Join Date
    Feb 2004
    Posts
    29
    After Family is selected, I want the corresponding data from Col4 and Col5.. and so on formatted below the box.
    first make drop down box of all data of table as
    second, do you want the user to manually select all fields or only on the base of family all will be selected.?

    here is the code for drop down list
    Code:
    <?
    $sql="select* from table";
    $result=mysql_query($sql);
    ?>
    <select name="family">
    <?
    while($disp=mysql_fetch_array($result))
    {
    ?>
    <option value="<?echo $disp['flight_no']?>"><?echo $disp['flight_no']?>
    <?
    }
    ?>
    </select>
    so first make all drop down lists, and post your code if you are finding errors.

Posting Permissions

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