473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

selecting values from a table of one server to insert them into another server by php

hi all i have two servers each having a table in them, i'm able to connect to them using php. But when i try to select the values from one table of a server to insert them into another table in another server that is not working even i had given all the privileges can one show me how to do that.....


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $dblink2 = mysql_pconnect('test1.deftlogic.com', 'dtestone_ipab','!*D-pD)g5)FJ'); // connect server 2
  4.  
  5. mysql_select_db('dtestone_db_2025', $dblink2);  // select database 2
  6.  
  7. echo $dblink2;
  8.  
  9. if(!$dblink2)
  10. {
  11.     echo "not connected";
  12. }
  13. else echo "db2 connected";
  14.  
  15. $dblink1 = mysql_connect('localhost', 'dtestfor_ipab','IaMzieU3#b%$'); // connect server 1
  16. mysql_select_db('dtestfor_IPAB_db',$dblink1);  // select database 1
  17.  
  18. if(!$dblink1)
  19. {
  20. echo "not connected";
  21. }
  22. else echo "db1 connected";
  23. echo "<br/>";
  24.  
  25. echo $dblink1;
  26.  
  27. $rs=mysql_query("INSERT INTO dtestfor_IPAB_db.bd_paidabribe (city, dept, amount) SELECT
  28.     SUBSTRING_INDEX(message, ',', 1),
  29.     SUBSTRING_INDEX(SUBSTRING_INDEX(message, ',', 2), ',', -1),
  30.     SUBSTRING_INDEX(message, ',', -1))as 'ma'
  31. FROM dtestone_db_2025.sms");
  32. ");
  33.  
  34. echo mysql_error();
  35. ?>
Apr 24 '12 #1
0 1429

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Frank Natoli | last post by:
Have two tables "abc" and "xyz", where "xyz" is a superset, column-wise, of "abc". Is there any simple way to inject all the rows of "abc" into "xyz"? Tried "insert into xyz select * from abc"...
1
by: Alexander | last post by:
Hi there! I need to write an sql statement, that inserts a blank (empty) row into a table. I tried "Insert Into tabname", "Insert Into tabname () VALUES ()" "Insert Into tabname VALUES ()"
6
by: David | last post by:
I am trying to insert an employee number into the EmpNbr field in my main table from a form where I add a new employee to my employee table. I was hoping this command would work, but it isn't. ...
14
by: Samy K | last post by:
I'm having a bit of problems entering a new row to an access database and what I would like to know is do I have to assign certain values in my INSERT INTO SQL statement. I have read about the...
29
by: pb648174 | last post by:
I have the following basic statements being executed: Create a temp table, #TempPaging Insert Into #TempPaging (Col1, Col2) Select Col1, Col2 From SomeOtherTable Order By Col2, Col1 Select...
12
by: ltanvo | last post by:
Hi, I try to run several insert into sql statements in direct MS access at same time. For ex. INSERT INTO Mytable(F1, F2) VALUES('V11', 'V12') INSERT INTO Mytable(F1, F2) VALUES('V21', 'V22')...
7
by: underground | last post by:
I wonder if possible on page load to query the value of a specific colmn and insert the result into another table. My query looks like so <? include("include/session.php"); ?> <? $usr =...
1
by: boss1 | last post by:
hi all, i m new in php.i have a problem that is i m using a php form where i can retrieve one field value from one table in oracle db by ajax and its working properly. but i need to insert the...
1
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into...
3
by: questionit | last post by:
Hi How do i write multiple values in a single column, using INSERT INTO I have a listbox and i want all the selected values from that listbox inserted into a table column INSERT INTO...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.