| | |
how to retrieve data from two tables
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 92
Reputation:
Solved Threads: 0
I need to manipulate two tables(in different DB) to print out data, what's the effective way to do that in php code?
$conn = mssql_connect($intraserver, $intrauser, $intrapass);
$db=mssql_select_db($intradb, $conn);
$result0=mssql_query("select a from tb1");// in $db
for ($i = 0; $i < @mssql_num_rows( $result0 ); ++$i)
{
$line = @mssql_fetch_row($result0);
$productname=$line[0];
$conn1 = mssql_connect($intraserver1, $intrauser1, $intrapass1);
$db1=mssql_select_db($intradb1, $conn1);
$result=mssql_query("procedure_in_db1 $productname"); //in $db1
$arr = mssql_fetch_row($result);
print "$arr[0]<br>";
mssql_close ($conn1);
}
mssql_close ($conn);•
•
Join Date: Jul 2009
Posts: 3
Reputation:
Solved Threads: 0
You'd be looking at using the mssql_query's second variable: the connection.
PHP Syntax (Toggle Plain Text)
$result=mssql_query("procedure_in_db1 $productname", $db1); //in $db1
![]() |
Similar Threads
- query to retrieve data from 3 tables (MySQL)
- retrieve data frm 2 tables (MySQL)
- retrieve data from database into jsp(urgent)!!! (Oracle)
- how to store and retrieve data from cookies (ASP.NET)
- VB.Net: Problem Retrieve data from ListView (VB.NET)
- How to retrieve data from a dynamically generated radio button (ASP.NET)
- retrieve data by VB.Net (VB.NET)
Other Threads in the PHP Forum
- Previous Thread: PHP Forum: how much time did it take you to create one?
- Next Thread: Php, ajax, mysql live search help
| Thread Tools | Search this Thread |
access alexa apache api array beginner binary broken cakephp checkbox class cms code convert cron curl database date directory display dropdown dynamic echo email encode error fairness file files folder form forms function functions google hack href htaccess html image include indentedsubcategory insert ip javascript joomla limit link login loop mail mail() menu methods mlm multiple multipletables mysql network newsletters oop passwords paypal pdf php problem provider query radio random recursion redirect remote script search secure server sessions simple sms soap source space sql syntax system table tutorial update upload url user validator variable variables video voteup web xml youtube





