Posted by Norman Peelman on 07/13/06 23:35
"Jim S" <try@to.guess> wrote in message news:U7utg.17$OI5.7@fe07.lga...
> 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.
> >
Try:
<?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; $i <= mysql_num_rows(); $i++)
{
$row=mysql_fetch_assoc($res);
echo "<option value='$row[job_name]'>$row[job_name]</option>";
}
echo "</select>";
?>
or
<?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>";
while($row=mysql_fetch_assoc($res))
{
echo "<option value='$row[job_name]'>$row[job_name]</option>";
}
echo "</select>";
?>
also:
mysql_fetch_row($res) = [0] numerical indicies
mysql_fetch_assoc($res) = ['job_name'] alphanumeric indicies
mysql_fetch_array($res, type) where type is MYSQL_NUM ([0]), MYSQL_ASSOC
(['job_name']), or MYSQL_BOTH ([0] & ['job_name'])
Norm
Navigation:
[Reply to this message]
|