Re: Challenge: MySql result to drop down box



Hmmm... u got some explainin to do.
what is wrong $username as a variable name? it's not a reserved word AFAIK
in either PHP or MySql
perhaps you are using it in another part of your code that you did not
disclose....thus making it a challenge for us to help you ;-)
As I said back on the 13th your revised code works for me.


"Jim S" <try@xxxxxxxx> wrote in message news:vY5vg.161$XR1.102@xxxxxxxxxxx
Ok--I found the problem. After beating my head on it for a few days I
realized the $username variable should have actually been $user_name O.o

Thank you for all who helped, I am sure the solutions I did implement
helped me to avoid other problems.

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>";
?>


.



Relevant Pages

  • Re: PHP and C#
    ... mySQL from your client - tyat way your username and password isn't exposed ... You can eliminate the PHP aspect completely and still have the ... for adding data either from a client or from an asp.net app, ... If it's done through MySQL ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Newbie Security Questions
    ... questions about PHP and its usage with MySQL. ... How to properly defend against an injection attack? ... I would be inclined to put the username, password, etc in a seperate ...
    (comp.lang.php)
  • allowing users to log into my website
    ... I have already created the backend using a MySQL ... database. ... username from one page to the next. ... I'm running Apache 2 and PHP ...
    (comp.lang.php)
  • Re: PHP and C#
    ... You send raw HTTP via the POST method. ... www.fiddlertool.com/fiddler/) to reverse engineer the PHP application. ... If it's done through MySQL ... if I don't store the username and password to the MySQL DB in ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I am totally stumped..with this on..LOAD_FILE Mysql+PHP= FSCK!!
    ... What I am trying to do is to upload files and stuff them in a mysql database. ... I copied the temporary file to somewhere else, and then handed it to MySQL..THAT WORKED.. ... Is there a way to force a close on the file..maybe that's the problem Mysql is opening a file that is not flushed to disk maybe? ... I gew the feeling its maintaining its own picture of file objects, and doesn't actually flush to the disk unless you do a copy or close php.. ...
    (comp.lang.php)