function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
M.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);
}
?>
SuperfellSuperfell
Its probably throwing an error, where do you setup $sforce ? (for the $sforce->query($query) line)
M.M.
I didn't understand the setup question... I've just started programming php last week... This is all very new to me.... sorry
adamgadamg
You might want to check your server's error.log to see if there is any useful debugging info there.
M.M.
there's no error log
SteveBowerSteveBower

Ask yourself the question:  What is the "$sforce" in the $sforce->query call?

If you're new to PHP you need to dig and RTFM a bit more.  There are ample resources on how to debug, use web server log files, etc.

best of luck, Steve

Ron HessRon Hess
i think you need to call quey like this

$mySforceConnection->query(...