|  | Posted by "Richard Lynch" on 12/30/05 22:23 
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
  Navigation: [Reply to this message] |