• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Update two at the same time...

Participant ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

How can I update two mysql databases (on two servers) at the same time. DO I need to give permission to send data?

E.g. The swf is in server A and I want to post data to 2 databases in server A and server B. But when I do it only updates in server A. Nothing goes to server B. How can I do this? Is this got to do with php? Please advice.

<?php

//SERVER A

$link = mysql_connect("localhost","abc","abc1");

mysql_select_db("my_db1");

$query = "INSERT INTO abc_db(subject, links) VALUES('$hsubjects','$link')";

$result = mysql_query($query);

//SERVER B

$links = mysql_connect("xxx.xxx.xx.xxx","xyz","xyz1");

mysql_select_db("my_db2");  

$query = "INSERT INTO notice_db(subject, links) VALUES('$hsubjects','$link')";

$result = mysql_query($query);

$sentOk = "The data has been added to the database.";

echo "sentOk=" . $sentOk;

?>

TOPICS
ActionScript

Views

747

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

you almost certainly have a cross-domain security issue.

search for a php cross-domain proxy script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

Thank you. I found this php script. But where should I save the file on the server? on the root?

<?php

$post_data = $HTTP_RAW_POST_DATA;

$header[] = "Content-type: text/xml";

$header[] = "Content-length: ".strlen($post_data);

$ch = curl_init( $_GET['url'] );

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 10);

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

if ( strlen($post_data)>0 ){

    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

}

$response = curl_exec($ch);    

$response_headers = curl_getinfo($ch);    

if (curl_errno($ch)) {

    print curl_error($ch);

} else {

    curl_close($ch);

    header( 'Content-type: ' . $response_headers['content-type']);

    print $response;

}

?>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

that would go on the same server as your html and swf.  your swf would call that (local) php passing the appropriate parameters so the script could call your cross-domain php script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

I was not successful. Are you able to show a working crossdomain script?

my swf & html > on SERVER A

php file to post data to the mysql > > on SERVER A

cross-domain file > on SERVER A

mysql 1 > > on SERVER A

mysql 2 > on SERVER B

php file to post data to the mysql > > on SERVER B

FLA

BUTTON 1

data to SERVER A

senderLoad.sendAndLoad("http://www.myweb1.com/x_proxy.php",receiveLoad);

BUTTON 2

data to SERVER A

senderLoad.sendAndLoad("http://www.myweb1.com/x_proxy.php?url=http://www.myweb2.com/bpx_db.php",receiveLoad);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

no, i don't have one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

Thanks for the guidance.  I hope I'll be able to complete my task.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2010 Aug 15, 2010

Copy link to clipboard

Copied

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

Hello @Ron_Colmen ,
Do you remember where you found that PHP script? Do you happen to know what license that script has? @kglad, do you have any idea?

I really appreciate any help you can provide. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

LATEST

@Andrei Nicola28931314es3o 

 

i have no idea.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines