Re: Challenge: MySql result to drop down box



I think I have narrowed it down to the for loop causing the problem...

Jim S wrote:
I have made the two changes you suggested but am still not receiving a result set. Let me repost my modified code.

<?php
$res=mysql_query("SELECT DISTINCT job_name FROM oats_jobs_users_laborCode where user='$username' order by job_name");
echo "<select name=jobname> <option default='default'>Choose One</option>";
for ($i=0; $row=mysql_fetch_row($res); $i++)
{
echo "<option value='$row[0]'>$row[0]</option>";
}
echo "</select>";
?>

And thank you for the mysql_fecth_rows command--it was helpful in other places as well :-)

Rik wrote:
And now I see this:

echo "<option value='<? echo $row[0];?>'><? echo
$row[0];?></option>";

That will not echo what you want it to echo.
Think about it, <?php ?> tags aren't nestable, why should they?

echo "<option value='$row[0]'>$row[0]</option>";

Grtz,
.



Relevant Pages

  • Re: [PHP] ZIP it :o)
    ... This is Christian Haensel live from Extertal, ... and in the archives). ... I had same problem lately, wanted also to create zip files from PHP, i ... Jim Lucas ...
    (php.general)
  • [SLE] Re: Konqueror / PHP question...
    ... On Saturday 04 December 2004 20:40, Sunny wrote: ... >> When I try to open a php file in konqueror I get the script. ... >> JIM ...
    (SuSE)
  • Re: Has anyone used Form Processor Pro from MitriDAT?
    ... Microsoft MVP-FrontPage ... -- "Jim Holtan" wrote in message ... > I'm a non-PHP person on a PHP enabled server, so I'm looking for a tool that> will deal with the PHP portion. ... >> Steve Easton ...
    (microsoft.public.frontpage.programming)
  • Re: Challenge: MySql result to drop down box
    ... Let me repost my modified code. ...
    (alt.php)
  • Re: [PHP] OOP in PHP
    ... You've solved my problem, Jim. ... superclass koneksi dipanggil ... "Some men are born to greatness, some achieve greatness, ...
    (php.general)