Activity Forums Salesforce® Discussions Sql request problem

  • Sql request problem

  • Michel Dupont

    Member
    June 1, 2021 at 12:15 pm

    Hi
    until now I used php 5.6 and for sql request i had created a dynamic syntax like this:

    function getInfo($table,$where,$field,$path="",$single="yes"){
    	$mySforceConnection=connectTOsf($path);
        $res=array();
        $tab_field=array();
      $contact="";
      $x=0;$z=0;
      try{ 
        $query = "SELECT ".$field." from ".$table." ".$where; 
      	$response = $mySforceConnection->query($query);   
        $queryResult = new QueryResult($response);
        $tab_field=explode(",",$field); 
      	for ($queryResult->rewind(); $queryResult->pointer < $queryResult->size; $queryResult->next()) 
      	{  
      		$record=$queryResult->current();
      		for($i=0;$i<count($tab_field);$i++)
                   {  
                       if($tab_field[$i]=="Id") $value=$queryResult->current()->Id;
                       else                     $value=$record->fields->$tab_field[$i];
                       ..... suite du traitement
                   }
           }
    .........

    It worked very well, but now with php7 the $value (not ID whose is static) are empty, and the values contain in $tab_field[$i] are correct.
    Is somebody can help me please?
    Thanks a lot in advance

Viewing 1 of 1 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Popular Salesforce Infographics