473,403 Members | 2,366 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,403 software developers and data experts.

sql+php help

hy

I have two mysql servers. One is on my local comp (localhost) and the other
is something.com
Creating simple php script to do this...

----------------------------------------------------------------------
$db1 = mysql_connect("something.com", "username", "pass") or die("Could not
connect.");
if(!$db1)
die("no db");
if(!mysql_select_db("smjestaj",$db1)) die("No database selected.");
$db2 = mysql_connect("localhost", "username", "pass") or die("Could not
connect.");
if(!$db2)
die("no db");
if(!mysql_select_db("smjestaj",$db2)) die("No database selected.");

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

i nead to execute this query on my local comp's web server.

update table2
set zauzetost = t1.zauzetost
from table2 t2, table1 t1
where t2.id = t1.id
table2 is on remote server, table1 is on local comp.
How to do this? I'm poor coder, so...

tnx in advance on your brain cells.
Dejan

Jul 10 '06 #1
4 1220
Dejan wrote:
hy

I have two mysql servers. One is on my local comp (localhost) and the other
is something.com
Creating simple php script to do this...

----------------------------------------------------------------------
$db1 = mysql_connect("something.com", "username", "pass") or die("Could not
connect.");
if(!$db1)
die("no db");
if(!mysql_select_db("smjestaj",$db1)) die("No database selected.");
$db2 = mysql_connect("localhost", "username", "pass") or die("Could not
connect.");
if(!$db2)
die("no db");
if(!mysql_select_db("smjestaj",$db2)) die("No database selected.");

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

i nead to execute this query on my local comp's web server.

update table2
set zauzetost = t1.zauzetost
from table2 t2, table1 t1
where t2.id = t1.id
table2 is on remote server, table1 is on local comp.
How to do this? I'm poor coder, so...
You query table1 and table2 and store those in two multi dimensional arrays,
then you create your third multi dimensional array into where you store the
joint rows of table1 and table2.
//Aho
Jul 10 '06 #2
Yeah right. I have tried playing with multidimensional arrays, buth with my
knowlege :))

Why cann't i use this with what sql query?

You query table1 and table2 and store those in two multi dimensional
arrays,
then you create your third multi dimensional array into where you store
the
joint rows of table1 and table2.
//Aho

Jul 11 '06 #3
Dejan wrote:
Yeah right. I have tried playing with multidimensional arrays, buth with my
knowlege :))

Why cann't i use this with what sql query?
>>You query table1 and table2 and store those in two multi dimensional

arrays,
>>then you create your third multi dimensional array into where you store

the
>>joint rows of table1 and table2.
//Aho


Unless something has changed, you can't query across databases on
different servers.

Also, if you ask a question in a PHP group expect to get a PHP response.
If you want a MySQL response, try a MySQL group such as
comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 11 '06 #4
Mel
On 2006-07-11 21:58:26 +1000, Jerry Stuckle <js*******@attglobal.netsaid:
Dejan wrote:
>Yeah right. I have tried playing with multidimensional arrays, buth with my
knowlege :))

Why cann't i use this with what sql query?
>>You query table1 and table2 and store those in two multi dimensional

arrays,
>>then you create your third multi dimensional array into where you store

the
>>joint rows of table1 and table2.
//Aho



Unless something has changed, you can't query across databases on
different servers.

Also, if you ask a question in a PHP group expect to get a PHP
response. If you want a MySQL response, try a MySQL group such as
comp.databases.mysql.
I don't know if it's valid SQL (or just T-SQL), but:
MSSQL supports connecting to multiple servers in a single statement. Ex:
select tbl1.*, tbl2.*
from localhost.mylocaldatabase.dbo.table_one as tbl1
join otherhost.myremotedatabase.dbowner.table_two as tbl2 on tbl1.id = tbl2.fk

Jul 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Quinonez | last post by:
i have a multiparagraph statement in a mysql database. its called out by PHP. if i do not put <br> at the end of each paragraph, the result is the statement all as one paragraph and when called in...
3
by: slash | last post by:
Hi , Im new to MySql and i have no idea how to convert a sql server user defined function to MySql. Can any one help me.. CREATE FUNCTION ChildCategories (@categoryId int, @taxId int,...
7
by: The Man | last post by:
Hello All: I am in desparate need of assistance. We are using an application called PaperVision Enterprise which takes scanned invoices and puts them into a database for the purpose of easy...
20
by: johnnyboy7 | last post by:
I don't know a lot about ASP and I know even less about SQL. I have been trying to search the web for information to be able to get done what I need. I've tried piecing things together from many...
8
by: afraze | last post by:
I want to write this sql query: Select * from table1 limit 0,5 when i wanted to use php parameter for this query, i got syntax error. My code: ... $count = 0;
1
by: maconbot | last post by:
hi all, please exuse my email ">" i am working on location. > hey team, thanks for the quick reply. > > i am trying to parse a pop3 account and populate it into flash. > > the how to code......
0
NeoPa
by: NeoPa | last post by:
Introduction: This seems like a very straightforward topic. Why would anyone need help finding MS Access Help related to this topic? I can't really answer that except to say that I know from...
1
anfetienne
by: anfetienne | last post by:
i have coding to select a certain row and then echo/print all values onto a page.....but when everything is echoed all it shows is the values from the 1st column which is tempID.....how can i change...
4
by: lscruiser | last post by:
PAGINATION QUESTION This code displays the same 5 results from the database. How do I get the page to reference the next or previous group of 5 results? I am using ODBC, SQL, and PHP. LIMIT won't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.