Click to See Complete Forum and Search --> : list


sandro27
01-09-2005, 04:59 PM
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

ray326
01-09-2005, 05:49 PM
Mark it up using an unordered list: <ul><li></li>...</ul>.

the tree
01-10-2005, 10:45 AM
Just what ray said, start with this:<ul>
<li>Breakfast included</li>
<li>Resturant</li>
<li>Et Cetera</li>
</ul>

Then tame those lists (http://www.alistapart.com/articles/taminglists/) and you'll be sorted.

sandro27
01-10-2005, 05:25 PM
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

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

<?
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

ray326
01-10-2005, 09:43 PM
Sorry. I'm not a PHP guy but one will come along I'm sure.

saji
01-11-2005, 09:41 PM
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

sandro27
01-12-2005, 06:23 PM
Hi Saji.

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

sandro27