Re: Challenge: MySql result to drop down box



Jim S wrote:
I think I am just missing something silly. I have tested my query and
it seems to be functioning fine. I have another similar query that
runs just before this one so the issue isn't a connection. If you
have any other questions I'd be happy to answer them.

Platform: mysql 3.x, php5

<?php
$res=mysql_query("SELECT 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_assoc($res); $i++)
{
echo "<option value='<? echo $row[0];?>'><? echo
$row[0];?></option>";
}
echo "</select>";

If you use mysql_fetch_assoc, don't use an enumerated array.
Either use mysql_fetch_assoc & $row['job_name'], or use mysql_fetch_row &
$row[0].

Grtz,
--
Rik Wasmus


.



Relevant Pages

  • Re: ASP - FROM statement slows down connection to database
    ... Open your database in Access, switch to the Queries tab, create a new query ... in Design View without choosing a table, swtich to SQL View, paste the sql ... connection string rather than using an ... recordset open statements. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Update checking
    ... My thought was to use a simple query with a "username" param ... concurrency exceptions happen if the data you queried has ... > was and basically let the user work in a similar offline mode. ... Where does connection pooling come ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: MS Access looks for .mdb rather than Progress schema
    ... # Same query previously worked in Progress 8.x using SQL89. ... This entry allows you to keep your existing code written with the ODBC ... BTW, if you put all of the connect information into the connect string, ... I also tried putting the whole thing in the connection string: ...
    (microsoft.public.access.modulesdaovba)
  • Re: OpenDataSource & stored procedure
    ... recognises the ODBC escape syntax. ... You shouldn't need the connection parameter since Word gets it from the ... return multiple result sets - enough to confuse software such as MS Query ... >>> The call works in MSQuery but won't return the data to Word. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Is yahoo being hijacked?
    ... I get no server response when query ... > Connection: close ...
    (misc.invest.stocks)