You need to sign in to do that
Don't have an account?
M.
why doesn't this php query work?? help please
Hello, can anyone help me with this?
This code is not working very well...
until the second "Try" everything works well....
but, when I get to the query it doesn't even print the "NOT REACHING THIS PRINT!", print...
can anyone help me with this please?
<?php
require_once ('C:\Program Files\PHP\ext\soapclient\SforcePartnerClient.php');
try
{
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
$mylogin = $mySforceConnection->login("admin@*****.com", "******");
print "Reaching this print";
$userResult = $mylogin->userInfo;
print $userResult->userFullName.', your session id is '.$mylogin->sessionId;
}
catch (Exception $e)
{
echo $e->faultstring;
}
try
{
// $result = $sforce->query(array("queryString" => "select Id, FirstName, LastName from Lead where Lead.FirstName='Miguel'"));
// print_r($result);
$query = "select Id from Lead where Lead.FirstName='Miguel'";
$result = $sforce->query($query);
print_r($result);
print "NOT REACHING THIS PRINT!";
} catch (Exception $e)
{
print_r($e);
}
?>
This code is not working very well...
until the second "Try" everything works well....
but, when I get to the query it doesn't even print the "NOT REACHING THIS PRINT!", print...
can anyone help me with this please?
<?php
require_once ('C:\Program Files\PHP\ext\soapclient\SforcePartnerClient.php');
try
{
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
$mylogin = $mySforceConnection->login("admin@*****.com", "******");
print "Reaching this print";
$userResult = $mylogin->userInfo;
print $userResult->userFullName.', your session id is '.$mylogin->sessionId;
}
catch (Exception $e)
{
echo $e->faultstring;
}
try
{
// $result = $sforce->query(array("queryString" => "select Id, FirstName, LastName from Lead where Lead.FirstName='Miguel'"));
// print_r($result);
$query = "select Id from Lead where Lead.FirstName='Miguel'";
$result = $sforce->query($query);
print_r($result);
print "NOT REACHING THIS PRINT!";
} catch (Exception $e)
{
print_r($e);
}
?>
Also, please take a look at http://us.php.net/manual/en/language.exceptions.php . query() throws an exception if it fails and is caught by the catch block. Thus, in an error your print statement won't be run. This is very, very basic programming knowledge.
is this your complete program?
just guessing:
$result = $sforce->query($query);
where do you create $sforce?
maybe it should be like this:
$result = $mySforceConnection->query($query);
regards,
ro