I have 2 seperate Databasis.
Both of them have the same table but different values.
I need to select out of both these DB, then ORDER them together.
For now I'm trying to write it to a temp table, but this doesn't work yet:
<?
//select values from the 1st database
$conn = mysql_connect( "localhost", "username1", "password1" );
$sql = mysql_select_db( "database1" );
$rs = mysql_query("Select * from incidents");
$rows = mysql_num_rows($rs);
if(mysql_num_rows($rs))
{
while ($row = mysql_fetch_array($rs))
{
echo $row['incident_number'];
}}
//select values from the 2nd database
$conn1 = mysql_connect( "localhost", "username2", "password2" );
$sql1 = mysql_select_db( "database2" );
$rs1 = mysql_query("Select * from incidents");
$rows1 = mysql_num_rows($rs1);
if(mysql_num_rows($rs1))
{
while ($row1 = mysql_fetch_array($rs1))
{
echo $row1['incident_number'];
}}
//then I try to write them to a temp table in 1st db, but it only writes 1 value
$row['incident_number'] = $incident_number;
$incident_number = $_POST['incident_number'];
$conn3 = mysql_connect( "localhost", "username1", "password1" );
$sql3 = mysql_select_db( "database1" );
$sql3 = "insert into incidenttemp (incident_number)
values ('$incident_number')";
$rs3 = mysql_query( $sql3, $conn3 );
?>
I did Google it, but can only find multiple table selects:
<?
SELECT * FROM table ORDER BY (field1 / field2) DESC
?>
Isn't there a way I can Select like this, but from seperate Databasis?
Else there should be a better way to just ORDER the values, without having to write to a temp table.
Any ideas?