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
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
to: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
(ID, description)
VALUES (pm_id, pm_description);
COMMIT;
END sforce_opp_insert_test;/
and thisPHP Code:CREATE PROCEDURE sforce_opp_insert_test
(
IN pm_id VARCHAR(2),
IN pm_description LONGBLOB
)
BEGIN
INSERT INTO php_opportunity (ID, description)
VALUES (pm_id, pm_description);
COMMIT;
END
to:PHP Code://set up PL/SQL Statement
$strsql = "begin sforce_opp_insert_test(";
$strsql .= ":pm_id,";
$strsql .= ":pm_description";
$strsql .= "); end;";
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.
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...
I tried...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; }
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.Code:foreach ($data->records as $r)
Please help.
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
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
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.
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.)PHP Code:$sql = "INSERT INTO sforce_opportunity
(id, description, project_comments__c)
VALUES
('$id', '$description', '$comments')
";
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
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
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
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.
Bookmarks