I want convert an Table of Data to an MultiDimensionArray
Hi,
I have a Database with a Table, in this Table contain 251 records, the structure of this Table is as the follow:
CREATE TABLE `nodes` (
`customers_id` int(10) NOT NULL auto_increment,
`customers_number` varchar(6) collate latin1_bin NOT NULL default '000000',
`customers_referer_no` varchar(6) collate latin1_bin NOT NULL default '000000',
`customers_group_no` varchar(6) collate latin1_bin NOT NULL default '000000',
`customers_child_count` tinyint(1) NOT NULL default '0',
`customers_level` int(11) NOT NULL default '0',
PRIMARY KEY (`customers_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
"customers_id" is auto_increment and not important in my this question
"customers_number" is an VarChar
"customers_referer_no" is not important in my this question
"customers_group_no" is important, when a "customers_group_no" of a "customers_number" is equal a "customers_number", this mean this "customers_number" is child of that "customers_number"
"customers_child_count" is the numbers of child of this "customers_number"
"customers_level" is the level of this customer in tree
example:
"customers_number" = '056098'
"customers_group_no" = '015458'
this main "customer 056098" is child of "customer 015458"
a customer can have maximum five child.
for more information please INSERT the attach (SQL) file in your phpMyAdmin.
with the following SQL Command, you can found the childs of a "customer 015458"
SELECT * FROM nodes WHERE customers_group_no = '015458' AND customers_number <> '015458'
and the question
I want to found all child of a customers and save in an array.
Ex:
$x = array of string;
$x[1]['056098'][1] = '015458';
$x[1]['056098'][2] = '802510';
$x[1]['056098'][3] = '875485';
$x[1]['056098'][4] = '698548';
$x[1]['056098'][5] = '282548';
$x = array('056098' = ('015458', '802510','875485','698548','282548'), '025485' = ('054874','254584','658754'), '587458' = ('025487','658985')).....
This question very IMPORTANT for me :-)
Please help me :-)
Thank in advanced,
Alireza
Last edited by laserayaneh; 02-24-2009 at 03:43 PM..
|