for??????
| From: | Bsantos PHP | Date: | Mon, 28 Oct 2002 17:22:39 +0000 |
| Subject: | for?????? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-121747@lists.php.net to get a copy of this message | ||
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