Reply to Re: SQL driven HTML Menus?

Your name:

Reply:


Posted by Joe Makowiec on 12/29/05 15:05

On 29 Dec 2005 in alt.php.sql, powerx wrote:

> Would have thought this was a FAQ but I'm having trouble googling it
> so any help appreciated...
>
> I have an SQL database
>
> ID BRAND
> 1 Apples
> 2 Pears
> 3 Oranges
> 4 ...
> 5 ...
>
> What is the easiest way of getting the SQL "Brand List" into a
> dropdown menu in my HTML / PHP page. It should automatically update
> when new items are added?

Pseudocode; adapt to your serverside scripting:
<!-- Create a recordset -->
<$ SELECT ID, BRAND FROM database ORDER BY BRAND $>
....
<select name="myselect">
<!-- Start of repeat region code goes here -->
<option value="<$ print ID $>"><$ print BRAND $></option>
<!-- End of repeat region code goes here -->
</select>
....

--
Joe Makowiec
http://makowiec.org/
Email: http://makowiec.org/contact/?Joe

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация