#1 (permalink)  
Old 02-26-2006, 01:11 PM
Registered User
 
Join Date: Dec 2005
Posts: 16
webadpro is on a distinguished road
cPanel/WHM API help

Hi,

I was just wondering, can you run a string in a function or does it has to be standalone.

I'm using whmreq function.

What I mean extactly is this:

If I write my coding and at the end I add:

$bob = $test->adding($host,$user,$accesshash);

It runs adding and adds the package, like it suppose to do,
but if I add that line in a function... nothin works.

Please help,
I'm in big need.

Regards,
Pat
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2006, 09:28 PM
Spiral's Avatar
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Two words .... "variable scope"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2006, 10:28 AM
Registered User
 
Join Date: Dec 2005
Posts: 16
webadpro is on a distinguished road
Could you explain a bit more please!?

Regards,
Pat
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2006, 10:25 PM
Registered User
 
Join Date: Dec 2005
Posts: 16
webadpro is on a distinguished road
any more help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-01-2006, 10:52 PM
Registered User
 
Join Date: Apr 2003
Posts: 476
elleryjh
The function doesn't have access to the variables $test, $host, $user, and $accesshash etc.

You can use the global keyword to get the vars from the global scope

PHP Code:
<?
function xxx(){
global 
$test$host$user$accesshash;
$bob $test->adding($host,$user,$accesshash);

}
?>

or pass in the vars as arguments to the function:
PHP Code:
<?
function xxx($test$host$user$accesshash){
$bob $test->adding($host,$user,$accesshash);

}
?>
But you should read up on your variable scope. It's a basic part of programming PHP.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-02-2006, 03:18 PM
Registered User
 
Join Date: Dec 2005
Posts: 16
webadpro is on a distinguished road
Thanks Everyone!

It's finally Working!

BIG THANKS!

Last edited by webadpro; 03-02-2006 at 04:11 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:13 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc