Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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
    Attached Files Attached Files
    Last edited by laserayaneh; 02-24-2009 at 03:43 PM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •