www.webdeveloper.com
Results 1 to 7 of 7

Thread: list

  1. #1
    Join Date
    Aug 2004
    Location
    Florianópolis
    Posts
    267

    list

    Hi all!!

    I am trying to display a vertical list from a database but I would like advice how to do it.

    My database has the following fields:
    facilites_id

    Hotel_id

    list_facilities - Here is where the data list is stored (swimming pool, restaurant, bar, etc)


    I would like to disply this data in a vertical list like this:
    # Breakfast Included
    # Restaurant
    # Internet Access
    # Airport Pick Up
    # etc

    Unfortunately the words come in sequence.

    Maybe my table design is weak. I could try the yes/no but I don´t know how to do it.

    Any suggestions

    sandro27

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Mark it up using an unordered list: <ul><li></li>...</ul>.

  3. #3
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    Just what ray said, start with this:
    Code:
    <ul>
    <li>Breakfast included</li>
    <li>Resturant</li>
    <li>Et Cetera</li>
    </ul>
    Then tame those lists and you'll be sorted.

  4. #4
    Join Date
    Aug 2004
    Location
    Florianópolis
    Posts
    267
    Thanks guys. However I another problem.

    Let´s say I have 2 tables:

    facilities ( facilities_id, facilities_name)
    hotel_facilities ( hotel_id, facilities_id)

    I am trying to get data from this tables with sql
    PHP Code:
    include "intro.php";
    $sql1="select * from hotel_facilities,facilities where 
    facilities.facilities_id=hotel_facilities.facilities_id
    and acc_id=    '
    $acc_id' order by facilities_name";
    $busca1=mysql_query($sql1,$conexao) or die(mysql_error());
    $lista1=mysql_fetch_array($busca1); 
    then I show like this
    PHP Code:
    <?
    while($lista1=mysql_fetch_array($busca1)){
    ?>
    <ul></ul><li><?=$lista1['facilities_name']?></li>
    <?
    }
    ?>
    The problem is that this doesn´t show all data in the table, always missing one.

    Wonder why and appreciate any help

    sandro24

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Sorry. I'm not a PHP guy but one will come along I'm sure.

  6. #6
    Join Date
    Jan 2005
    Posts
    10
    Hello,

    You have to remove the following line from the script.
    "$lista1=mysql_fetch_array($busca1);" which is under
    "$busca1=mysql_query($sql1,$conexao) or die(mysql_error()); ".

    The reason is, mysql_fetch_array would skip one row.

    Hope this will help you.

    Regards,
    Saji John

  7. #7
    Join Date
    Aug 2004
    Location
    Florianópolis
    Posts
    267
    Hi Saji.

    It worked perfectly. Thanks. The good be with you in 2005.

    sandro27

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles