Re[2]: [PHP] for??????

From: Date: Mon, 28 Oct 2002 17:54:47 +0000
Subject: Re[2]: [PHP] for??????
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121752@lists.php.net to get a copy of this message
Hello John, oh....im really tired then...should go home ;)))....than that $fields should do the work....$fields="id,name,email"; for example.....:))) and to count how many fields are u using...i think array should do the trick....you can count it then how many fields it has....but...maybe i am writing stupid things..i really need to go home ;))) okay... -- Best regards, Martin mailto:corwin@corwin.sk Monday, October 28, 2002, 6:45:15 PM, you wrote: JWH> He's talking columns, not rows. LIMIT is for rows. JWH> John >> -----Original Message----- >> From: Martin Hudec [mailto:corwin@corwin.sk] >> Sent: Monday, October 28, 2002 12:38 PM >> To: Bsantos PHP >> Cc: php-general@lists.php.net >> Subject: Re: [PHP] for?????? >> >> Hello Bsantos, >> >> BP> Now, I've created a funtion which controls how many fields (cols) JWH> 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 JWH> 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

« previous php.general (#121752) next »