The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Accounting Problem

Discussion in 'cPanel Developers' started by jimb, Dec 17, 2003.

  1. jimb

    jimb Member

    Joined:
    Sep 12, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hi guys,

    I'm trying to list accounts fromt he server in PHP, it all works except the username of the account - it gets displayed as "Array".

    Can anyone point me in the right direction - php.net's infomation or arrays and foreach() hasn't been much help.

    PHP:

    $listaccts 
    listaccts($host,$user,$accesshash,$usessl);
                
    foreach (
    $listaccts as $v1
    {
          
    $reply .= '<tr bordercolor=#FFFFFF>';
          
    $reply .= '<td>' $v1 '</td>';
          
          foreach (
    $v1 as $v2
          {
                
    $reply .= '<td>' $v2 '</td>';
           }

          
    $reply .= '</tr>';
    }
     
  2. TheGenie

    TheGenie Member

    Joined:
    Jan 19, 2002
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Saudi Arabia
    you need to do it like this and it will work as you want:

    PHP:
    $listaccts listaccts($host,$user,$accesshash,$usessl);
                
    foreach (
    $listaccts as $v1 => $v2
    {
          
    $reply .= '<tr bordercolor=#FFFFFF>';
          
    $reply .= '<td>' $v1 '</td>';
          
          foreach (
    $v2 as $v3
          {
                
    $reply .= '<td>' $v3 '</td>';
           }

          
    $reply .= '</tr>';
    }
     
Loading...

Share This Page