Re: list a query

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

 



On Wed, December 28, 2005 5:53 am, Ross wrote:
> What does 'list' do in a php query?

'list' is kind of like an array de-constuctor.

<?php
$example = array(1, 2, 3);
list($x, $y, $z) = $example;
echo "x: $x y: $y z: $z\n\n";
?>
x: 1 y: 2 z: 3

> $result = mysql_query($query) or die('Error, query failed');
> list($name, $type, $size, $content) = mysql_fetch_array($result);

$result is an array:

array('Ross', 'Hosting Company', 'Comfy', 'aztechost.com');

'list' is tearing that array apart into individual variables.

-- 
Like Music?
http://l-i-e.com/artists.htm

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