You are here: Re: [PHP] list a query « PHP « IT news, forums, messages
Re: [PHP] list a query

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация