it was as complete as need be to demonstrate my dilemma, as Richard has
discovered above
"Frank Arensmeier" <[email protected]> wrote in message
news:[email protected]...
23 mar 2011 kl. 02.42 skrev Jim Giner:
> ok - here's the code in question.
> $q = 'select * from director_records ';
> $qrslt = mysql_query($q);
> $rows = mysql_num_rows($qrslt);
> for ($i=0; $i<$rows; $i++)
> {
> $j = $i+1;
> $row = mysql_fetch_array($qrslt);
> echo $j.'-'.$row['userid'];
> if ($row['user_priv']<> "")
> echo ' ('.$row['user_priv'].')
';
> else
> echo '
';
> }
>
>
> The output I get is:
>
>
> 1-smith5
> f-ginerjm (M)
> g-smith8
>
> While the alpha parts are valid, the index is only correct for the first
> one
> (0) obviously.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Why not try some basic debugging strategies and see what you get?
Try:
for ($i=0; $i<$rows; $i++)
{
var_dump($i);
$j = $i+1;
$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];
var_dump($j);
if ($row['user_priv']<> "")
echo ' ('.$row['user_priv'].')
';
else
echo '
';
}
The output you've posted, that's rendered output, right? What's the raw
output?
By the way, the code snippet you gave us is not complete. Is there anything
else? As Dan noticed earlier, judging from that code snippet only, there
must be something else funky going on.
/frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php