Greetings,
I have created a page in PHP that pulls data from two databases on the same server. The data is then used in arrays to determine what "Ticket #" is in one db/table but not in the other. Using the print_r ($result) command at the end of my code shows me that my code is all working correctly.
My issue is taking this and make it display the returned data in a table format on the webpage. The 'print_r' options are generally only for debugging.
Does anyone have any insight on this?
The column headers in my table will be the actual column names from the tables in my initial 'customer sign-in' table.
"Sign in Date"
"RANK/CIV"
"First Name"
"Last Name"
"Unit"
"DSN/Roshan"
"Classifications"
"Services Requested"
"Service Tag/ Serial Number"
"Ticket #"
"Make/ Model"
<?php
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_in = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_in' );
$db_out = new MySQLi( $db_host, $db_user, $db_pass, 'sign_out' );
if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR );
$q_in = 'SELECT * FROM `customer sign-in`';
$q_out = 'SELECT * FROM `customer sign-out`';
if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE )
trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR );
$data_in = array(); $data_out = array();
while( $row = $r_in->fetch_assoc() )
$data_in[ $row['Ticket #'] ] = $row;
$r_in->free();
while( $row = $r_out->fetch_assoc() )
$data_out[ $row['Ticket #'] ] = $row;
$r_out->free();
$result = array_diff_key( $data_in, $data_out );
print_r( $result );
?>