| | |
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 |
.htaccess advanced ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html if...loop image include insert integration ip java javascript joomla jquery key library limit link login loop mail menu mlm mod_rewrite multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion regex remote screen script search server sessions smarty sms soap sorting source space sql startup syntax system table tutorial update upload url validation validator variable video web xml youtube zend





