You are here: Re: Array output from function into a new query « All PHP « IT news, forums, messages
Re: Array output from function into a new query

Posted by Stefan Rybacki on 09/28/52 11:44

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marc schrieb:
> Stefan Rybacki schreef:
>...
> Hi Stefan,
>

Hi again,

> I don't know what the max tree depth is, because for every bt/nt query
> it is different.
>
> Do you know how I can 'export' the full array out of this function to a
> query?

sure.

> Because when I move the $row['nt'] to the point you suggested. I only
> get one result instead of the whole array..

that was just a hint, not the exact solution ;)

try something like this: (attention, untested)

function display_children($parent, $level) {
// retrieve all children of $parent
$result_btnt = mysql_query('SELECT nt FROM btnt '.
'WHERE bt="'.$parent.'";');


$output=array();

// display each child
while ($row = mysql_fetch_array($result_btnt)) {
// indent and display the title of this child




// call this function again to display this
// child's children
$output['children'][]=display_children($row['nt'], $level+1);


}

return $output;


}

I just wonder how you get the root node.

Regards
Stefan
>
> Regards
> Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)

iD8DBQFEKe10yeCLzp/JKjARAsWHAKCm0xcToLDSlCNUcBp/N5FhCE6YWACgnr/Y
nv5sPwOE9qzM8opyrAbzJnU=
=Ptch
-----END PGP SIGNATURE-----

 

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

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