|
Posted by jsd219 on 06/14/07 05:00
On Jun 13, 11:13 pm, Norman Peelman <npeel...@cfl.rr.com> wrote:
> jsd219 wrote:
> > Hello, George and Toby helped me out with a scripted to populate a
> > drop down box from a dynamic section:
>
> > I am having an issue with the drop down box. If there is only one row
> > in the table the drop down box will display nothing. once the table
> > has two or more rows the drop down displays the row but always one shy
> > of the total. here is the script i am using:
>
> > $query = "SELECT SEC_TITLE
> > FROM section
> > WHERE SEC_TITLE != ''";
>
> > $result = mysql_query($query);
>
> > while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
>
> > { echo "<form action='#'>\r\n<select name=section>\r\n";
> > while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
> > $section = $line[0];
> > echo " <option value=$section>$section\r\n";
> > }
> > }
>
> > If anyone can help me get this drop down box to display all rows even
> > if there is only one row, i would really appreciate it.
>
> > Thanks
>
> > God bless
> > jason
>
> $query = "SELECT SEC_TITLE FROM section WHERE SEC_TITLE != ''";
> $result = mysql_query($query);
> echo "<form action='#'>\r\n<select name='section'>\r\n";
> while ($row = mysql_fetch_array($result, MYSQL_NUM))
> {
> echo " <option value='{$row[0]}'>$row[0]\r\n";}
>
> echo "</form>\r\n";
>
> Norm
Thank you :-)
God bless
jason
Navigation:
[Reply to this message]
|