Hello Bsantos,

BP> Now, I've created a funtion which controls how many fields (cols) may be
BP> seen by user. Some like this:

BP> function select_query ($fields, $table) {
BP> $result = ("SELECT $fileds FROM $table");
BP> }

maybe mistype in SELECT fileds should be fields....also try using
select_query() without that space between...i suppose you will
have something like select_query("email,name","userlist")

BP> Well, I hould like to control how many fields my query will use.

for example you will want first ten fields...then add
to query LIMIT 0,10 (it will start from first field, and it will
select ten fields)

BP> For example: if I call select_query('id,username,email', 'users');

BP> I want to know that there was selected 3 cols. so I can later do some like
BP> this:

well three cols are not difficult...just from what position u want to
have them (see LIMIT above)...

BP> for ($j=0;$j<$number_of_selected_cols_minus_one;$j++) {
BP>     echo"<td>$list[$j]</td>";

BP> ... and that's it. By the way!! Is this late statement correct?!?!

to this for statement...why are you doing minus one?...for example if
you have 10 selected cols...it will do that echo ten times for each
$j....not nine as in your original statement...you will have one $j

okay hope it helps for now

Best regards,
 Martin                            mailto:corwin@;corwin.sk

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

Reply via email to