Re: Building an array, kind of?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Or, if your mysql version allows it:

SELECT 1, GROUP_CONCAT(some_col) FROM history GROUP BY 1 LIMIT 0,16

That would take away the need to create a comma seperated string in php,
because mysql will have already done it for you ;-)


Dan Shirah wrote:
> 
> TGIF?
> 
> Apparently my brain isn't working this Friday.
> 
> I'm trying to query my table to get the first 16 ID's.  I then want
> to assign the ID's to a variable and have them comma seperated.
> 
> // My query to select the first 16 rows
> $get_charges2 = "SELECT FIRST 16 * FROM history WHERE id = '$id";
> 
> // Executing the query
>  $charge_result2 = ifx_query ($get_charges2, $connect_id);
> 
> How would I assign the result to a variable?
> 
> For instance, say my query returns rows like:
> 
> 1234
> 1235
> 1236
> 1237
> 1238
> 1239
> 
> How would I go about putting that in a variable to equal
> "1234,1235,1236,1237,1238,1239" ?
> 
> 


-----
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: http://www.nabble.com/Building-an-array%2C-kind-of--tp20151654p20162597.html
Sent from the PHP - General mailing list archive at Nabble.com.


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux