+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
This is a discussion on PHP & Salesforce - Full Data Extract Process Tutorial within the Salesforce PHP Tutorials forums, part of the Salesforce category; Hello Mike, great post, Can you please tell me how I can
  1. #11
    salesforuse is offline Junior Member
    Join Date
    Sep 2008
    Posts
    4

    paging with querymore

    Hello Mike,

    great post, Can you please tell me how I can use paging for such big records
    and display on request from my S-control?

    or just a paging in PHP code of batch 50 records.


    Thanks

  2. #12
    nil_von_9wo is offline Junior Member
    Join Date
    Aug 2009
    Posts
    10

    How do I do this in MySQL

    Forgive me if this question is a little out of scope, but since I couldn't get Oracle to play with PHP and I'm more interested in getting SalesForce to play with PHP, I've been adapting this tutorial to MySQL.

    So, I've changed this

    PHP Code:
    CREATE OR REPLACE PROCEDURE sforce_opp_insert_test (
       
    pm_id            IN  VARCHAR2,
       
    pm_description   IN  CLOB DEFAULT EMPTY_CLOB()
    )
    IS
    BEGIN
          INSERT INTO php_opportunity
                      
    (IDdescription)

               
    VALUES (pm_idpm_description);
    COMMIT;
    END sforce_opp_insert_test;/ 
    to:

    PHP Code:
    CREATE PROCEDURE sforce_opp_insert_test
    (
        
    IN pm_id            VARCHAR(2),
        
    IN pm_description    LONGBLOB
    )
    BEGIN
                INSERT INTO php_opportunity 
    (IDdescription)
                    
    VALUES (pm_idpm_description);
                    
                
    COMMIT;
    END 
    and this

    PHP Code:
    //set up PL/SQL Statement
            
    $strsql "begin sforce_opp_insert_test(";
            
    $strsql .= ":pm_id,";
            
    $strsql .= ":pm_description";
            
    $strsql .= "); end;"
    to:

    PHP Code:
    $strsql "
                                BEGIN sforce_opp_insert_test 
                                    (
                                        :pm_id, 
                                        :pm_description
                                    ); 
                                END;
                            "


    Unfortunately, this doesn't seem to be working as anticipated and I'm presently getting the following error:

    Debug Error: /SalesforcePHPTutorials/includes/adodb5/adodb-exceptions.inc.php line 78 - Uncaught exception 'ADODB_Exception' with message 'mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sforce_opp_insert_test
    (
    :pm_id,
    :pm_description
    ' at line 1] in EXECUTE("
    BEGIN sforce_opp_insert_test
    (
    :pm_id,
    :pm_description
    );
    END;
    ")
    ' in D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\include s\adodb5\adodb-exceptions.inc.php:78
    Stack trace:
    #0 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\include s\adodb5\adodb.inc.php(1043): adodb_throw('mysql', 'EXECUTE', 1064, 'You have an err...', '?????????BEGIN ...', false, Object(ADODB_mysql))
    #1 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\include s\adodb5\adodb.inc.php(1018): ADOConnection->_Execute('?????????BEGIN ...', false)
    #2 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\full_da ta_extract_process.php(61): ADOConnection->Execute('?????????BEGIN ...')
    #3 D:\temp\user\tmp\dummy.php(1): include('D:\Brian Stuff\...')
    #4 {main}
    thrown


    Any idea how I should fix this?

    Thanks in advance,

    -Brian.

  3. #13
    Wesleysakamoto is offline Junior Member
    Join Date
    Sep 2009
    Posts
    3

    After the get_accounts function, Zero's are returned

    Hi Mike,

    I wrote a get_data function mimicing your get_accounts function which works just fine. I have an array result set of about 7000 records. I tried iterating through all the Id's of the result set but I get zeroes, 7000 zeroes.

    Below is a code snippet of mine...

    Code:
     
    $data = get_data($username,$password,$token,$wdsl); //passed user info and other parameters from above into function to estab connection and execute query.
    foreach ($data as $r)
    {
    $r = new SObject($r);
    $id = $r->Id;
    echo $id;
    }
    I tried...

    Code:
    foreach ($data->records as $r)
    but PHP doesn't recognize $data as an object anymore and I get "Trying to get property of non-object" errors in the PHP server log.

    Please help.

  4. #14
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Wesley-

    I need to see more of your code and I understand if you cannot post it here. Can you PM or email it to me? It sounds like it is either a PHPToolKit version issue or something else

    ~Mike

  5. #15
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Quote Originally Posted by nil_von_9wo View Post
    Forgive me if this question is a little out of scope, but since I couldn't get Oracle to play with PHP and I'm more interested in getting SalesForce to play with PHP, I've been adapting this tutorial to MySQL.

    So, I've changed this

    PHP Code:
    CREATE OR REPLACE PROCEDURE sforce_opp_insert_test (
       
    pm_id            IN  VARCHAR2,
       
    pm_description   IN  CLOB DEFAULT EMPTY_CLOB()
    )
    IS
    BEGIN
          INSERT INTO php_opportunity
                      
    (IDdescription)

               
    VALUES (pm_idpm_description);
    COMMIT;
    END sforce_opp_insert_test;/ 
    to:

    PHP Code:
    CREATE PROCEDURE sforce_opp_insert_test
    (
        
    IN pm_id            VARCHAR(2),
        
    IN pm_description    LONGBLOB
    )
    BEGIN
                INSERT INTO php_opportunity 
    (IDdescription)
                    
    VALUES (pm_idpm_description);
                    
                
    COMMIT;
    END 
    and this

    PHP Code:
    //set up PL/SQL Statement
            
    $strsql "begin sforce_opp_insert_test(";
            
    $strsql .= ":pm_id,";
            
    $strsql .= ":pm_description";
            
    $strsql .= "); end;"
    to:

    PHP Code:
    $strsql "
                                BEGIN sforce_opp_insert_test 
                                    (
                                        :pm_id, 
                                        :pm_description
                                    ); 
                                END;
                            "

    Unfortunately, this doesn't seem to be working as anticipated and I'm presently getting the following error:
    Code:
    Debug Error: /SalesforcePHPTutorials/includes/adodb5/adodb-exceptions.inc.php line 78 - Uncaught exception 'ADODB_Exception' with message 'mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sforce_opp_insert_test 
                                    (
                                        m_id, 
                                        m_description
    ' at line 1] in EXECUTE("
                                BEGIN sforce_opp_insert_test 
                                    (
                                        m_id, 
                                        m_description
                                     
                                END;
                            ")
    ' in D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\includes\adodb5\adodb-exceptions.inc.php:78
    Stack trace:
    #0 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\includes\adodb5\adodb.inc.php(1043): adodb_throw('mysql', 'EXECUTE', 1064, 'You have an err...', '?????????BEGIN ...', false, Object(ADODB_mysql))
    #1 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\includes\adodb5\adodb.inc.php(1018): ADOConnection->_Execute('?????????BEGIN ...', false)
    #2 D:\Brian Stuff\Education\PHP\SalesforcePHPTutorials\full_data_extract_process.php(61): ADOConnection->Execute('?????????BEGIN ...')
    #3 D:\temp\user\tmp\dummy.php(1): include('D:\Brian Stuff\...')
    #4 {main}
      thrown
    



    Any idea how I should fix this?

    Thanks in advance,

    -Brian.
    Brian

    Sorry man I do not use or write functions in MySQL, but it seems like you have a sintax issue in your procedure

    What is it you are trying to do? Are you just trying to set up a replication from your tables/objects in Salesforce with MySQL? If that is it, I can surely help you with that and you would not need to write any procedures to accomplish this

    ~Mike

  6. #16
    nil_von_9wo is offline Junior Member
    Join Date
    Aug 2009
    Posts
    10
    Quote Originally Posted by mike View Post
    Brian
    What is it you are trying to do? Are you just trying to set up a replication from your tables/objects in Salesforce with MySQL? If that is it, I can surely help you with that and you would not need to write any procedures to accomplish this
    I was trying to adapt the script on page 1 to work on my system as a merely academic exercise.

    I managed to get it to work by using SQL to INSERT rather than using procedures.

    PHP Code:
                    $sql "INSERT INTO sforce_opportunity 
                                        (id, description, project_comments__c)
                                    VALUES 
                                        ('
    $id', '$description', '$comments')
                                "

    I suspect the problem may be that I have MySQL 5.0 which seems to only have limited support for procedures. (I had problems installing 5.1 and the 5.4 preview wasn't working correctly on my machine.)

  7. #17
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Brian,

    If you are using MySQL then you do not need to use procedures. There are other scripts on this site or I can email you an example to show you how to get a fully functional script that will work for each object

    It works fine and is tested against MySQl 5.*

    Let me know

    ~Mike

  8. #18
    JTec is offline Junior Member
    Join Date
    Oct 2009
    Posts
    2
    Hi Mike,

    We are developing a code to get more than 50.000 Account records in PHP and we re trying to use your tutorial but the page allways give us this error:
    ----------------------------------------------------------------------
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@captaconsulting.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    -----------------------------------------------------------------

    Can you help us? Our code is something like this:
    ----------------------------------------------------------------
    <code>
    //consulta

    if($rBusqueda->size > 0) {

    echo $rBusqueda->size;

    foreach($rBusqueda->records as $records){

    $totalId[] = $records->Id;

    }

    unset($records);

    while(!$rBusqueda->done){

    set_time_limit(0);

    $rBusqueda = $mySforceConnection->queryMore($rBusqueda->queryLocator);

    foreach($rBusqueda->records as $records){

    $totalId[] = $records->Id;

    }

    }

    }




    </code>

    ----------------------------------------------------------------

    Kind Regards

  9. #19
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    There is nothing wrong with your code that I can see man, but there seems like there is something wrong with the server setup or configuration. It could be something as simple as a bad .htaccess file or permissions issue on the script.

    ~Mike

  10. #20
    JTec is offline Junior Member
    Join Date
    Oct 2009
    Posts
    2

    Server error

    Thanks Mike.

    The real problem is that we have outsorcing of hosting, we don't have priviliges to modify the configuration of our server. Do you have any idea what can we do? Is there something more out of .htacces?

    Thanks for all.

+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2