Hi Bsantos,

Why not use the following code:

for ($i="0";$i<mysql_num_rows($result);$i++) {
        echo "<td>".result['$i']."</td>";
        }

I hope this helps. Should be easier then using
$number_of_selected_cols_minus_one because how do u get this one?
Probably like this, right? $number_of_selected_cols_minus_one =
mysql_num_rows($result)-1; This is shorter, and its not necessary to do
- 1 i think

Best regards,
 
Davy Obdam
mailto:info@;davyobdam.com


> -----Oorspronkelijk bericht-----
> Van: Bsantos PHP [mailto:bruno.santos@;mf.pt] 
> Verzonden: maandag 28 oktober 2002 18:23
> Aan: [EMAIL PROTECTED]
> Onderwerp: [PHP] for??????
> 
> 
> Hi people:
> 
> Can anybody help me with this? :
> 
> I've got a query in a table:
> 
> $result = mysql_query("SELECT username, email FROM users");
> 
> which should bring about 300 lines (each for an user).
> 
> Now, I've created a funtion which controls how many fields 
> (cols) may be seen by user. Some like this:
> 
> 
> function select_query ($fields, $table) {
> $result = ("SELECT $fileds FROM $table");
> }
> 
> Well, I hould like to control how many fields my query will use.
> 
> For example: if I call select_query('id,username,email', 'users');
> 
> I want to know that there was selected 3 cols. so I can later 
> do some like
> this:
> 
> for ($j=0;$j<$number_of_selected_cols_minus_one;$j++) {
>     echo"<td>$list[$j]</td>";
> 
> ... and that's it. By the way!! Is this late statement correct?!?!
> 
> 
> Thanks a lot to anyone that can help me, cheers,
> 
> 
> 
> bsantos
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> ================================================================
> Deze e-mail is door E-mail VirusScanner van Planet Internet 
> gecontroleerd op virussen. Op http://www.planet.nl/evs staat 
> een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
> 
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to