View Single Post

  #1 (permalink)  
Old 04-19-2008
Baldylocks-Ubuntu
 
Posts: n/a
Default Definition-list nesting problem

Hello

New poster to the group and a n00b to mySQL and PHP of a couple of weeks.

Built an Ubuntu server 2 weeks ago to fit in with my conversion of all the
pcs in the house to Linux. Have got MySQL and PHP running fine and got
stuck in converting my old Access dbs. So far am pleased with the results
in the time

I swore I wouldn't keep asking n00b questions in NGs and forums and would
figure things out, but this one is driving me insane.

Got my search page to produce a numbered list of clickable links, those
links then open a page with more details from that record - that works
fine. I am now trying to get the format of the details page right (the easy
bit I thought!)

I know I am missing something really basic and stupid and it is just a
problem with my nesting somewhere but I would really appreciate a pointer
please.

I am trying to produce a definition-list using the field name as the
definition-list term and the field content as the the definition-list
definition.

I can get a list of terms, or a list of definitions after a lot of trial and
error, I am now at the stage where I have both... but I have the terms as
one list and the definitions as another list below.

Here's the code:
//////////////////////////////////////////
// Printing results in definition list
echo "<dl>";
while ($headers = mysql_fetch_field($result)){
Â* Â* Â* Â* echo "<dt><h4>" . $headers->name . "</h4></dt>";
}
Â* Â* Â* Â* while ($entry = mysql_fetch_array($result, MYSQL_ASSOC)){
Â* Â* Â* Â* Â* Â* Â* Â* foreach ($entry as $col_value){
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "<dd>$col_value</dd>";
Â* Â* Â* Â* }
}

echo "</dl>";
/////////////////////////////////////////

Any help/pointers gratefully received.

Cheers

David
--
Knowledge is of two kinds: we know a subject ourselves, or we know where we
can find information upon it. (Samuel Johnson)
Only the mediocre are always at their best. (Jean Giraudoux)
(Reply address genuine - Checked occasionally)
Reply With Quote