Hey Guys! Wondering if maybe someone can help me out!

I'm trying to do something with API and i dont know why my code isnt working

basically i want the function to grab the user's ID# and then find them in the database. Now the only way that I can get the function to work is by actually setting the $conid inside of the function. eg: $conid = 198274;

Even thought when i echo the $conid it still displays...

So I'm getting an error:
ERROR: -1 - No method matching arguments: java.lang.String, java.lang.String, [Ljava.lang.Object;

And I'm guessing this error means that the $conid isnt set.

Here’s some code: FUNCTIONS.PHP

function getuser($sub, $conid) {
 if (isset($sub)) {
       // Connect to API
       require("isdk.php");  
       $app = new iSDK;
       $app->cfgCon("cashApp");

echo $conid; 

$returnFields = array('Email', 'FirstName', 'Id');
$loadcon = $app->loadCon($conid, $returnFields);      

THIS HERE DOESN’T MAKE THE UPDATE I JUST WANTED TO SEE IF IT WAS GRABBING DATA FROM INFUSION

echo "<pre>";
print_r($loadcon);     THIS PRINTS THE RESULT
echo "</pre>";

       // Update existing User 
       //   $conDat = array('Email'     => $email_2,
       //                   'FirstName' => $firstname,
       //                   'LastName'  => $lastname);
       //   $conID = $app->updateCon($Id_2, $conDat);

 } else {
       echo "No Data.";           
 }
}

GETRICH_PROCESS_FORM.PHP

$submit = $_GET['Submit'];
$id = $_GET['Id'];                       
echo getuser($submit, $id);

PS. I have had this working on another site put was using the form function POST instead of GET. Would that make a difference?

Any input would be appreciated! Thanks alot!

cwarn23 commented: Very well explained +6

PS. I have had this working on another site put was using the form function POST instead of GET. Would that make a difference?

Let me be the first to say welcome to daniweb. Also I would like to give you some credit as a first time poster as it is little comments like that which makes our lives so much easier.
The answer of the question lays in when you changed the data submission method from get to post. When changing this piece of html code you will need to adjust the php code accordingly. Why? Because when the method get is used, the data will be stored in the $_GET array. However when the post method is used, the data will be stored in the $_POST array. And because you changed from get to post you need to change $_GET to $_POST. Below is the corrected version of the code you have posted.

$submit = $_POST['Submit'];
$id = $_POST['Id'];                       
echo getuser($submit, $id);

A very simple problem and also note that the names inside the quotes are case sensitive.

commented: (: +11

Sorry it took me so long to re-reply...Also thanks for the warm welcome :)

I did change those variable to $_POST but it seems that solution hasn't fixed anything.

Its almost like the function wont pickup the $id

function getuser($sub, $id) {
	if (isset($sub)) {
		// Connect to API
		require("isdk.php");  
		$app = new iSDK;
		$app->cfgCon("cashApp");

echo $id;

$returnFields = array('Email', 'FirstName', 'Id');
$loadcon = $app->loadCon($id, $returnFields);

echo "<pre>";
print_r($loadcon);
echo "</pre>";

	} else {
		echo "No Data.";		
	}
	

	
	
}

echo $id - Will return the users $id, but the $id wont go into $loadcon unless i define it as $id = userid inside of the function...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.