Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    151
    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:
    301
    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>';
    }
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice