I believe there is some confusion between columns (fields) and rows.  LIMIT
is generally used to limit the returned rows, not fields.  If you want only
specific columns then select only the ones you want "SELECT
id,firstname,lastname,login FROM users ORDER BY lastname,firstname".

Jason

-----Original Message-----
From: Martin Hudec [mailto:corwin@;corwin.sk] 
Sent: Monday, October 28, 2002 10:38 AM
To: Bsantos PHP
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] for??????

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
extra...

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

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

Reply via email to