MOD i have another question.
my data fetching is already ok with this code.
PHP Code:
<?php
include("conn_db.php");
$output = array();
$output[] = "SO No.\tProduct\tModel No.\tWarranty\t";
// connect to mysql database
$num = 1;
$query = "SELECT so.so_no, pr.description as product, pr.model_no, w.warranty
FROM service_order AS so
LEFT JOIN product as pr ON pr.prod_id = so.prod_id
LEFT JOIN product_category as pc ON pc.code_cat = pr.code_cat
LEFT JOIN warranty as w ON w.warranty_id = so.warranty_id
$sql = mysql_query($query);
while ($row = mysql_fetch_object($sql)) {
$output[] = $row->so_no . "\t" . $row->product . "\t" . $row->model_no . "\t" . $row->warranty . "\t";
$num++;
}
mysql_free_result($sql);
// disconnect from database
$data = implode("\n", $output);
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=extraction.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data"; ?>
but when i try to add this query i got many errors
PHP Code:
$result = mysql_query("SELECT * FROM so_trouble_reported WHERE so_no = $so_no");
$getTr_id = mysql_fetch_array($result);
$result = mysql_query("SELECT * FROM trouble_reported WHERE tr_id = ".$getTr_id["tr_id"]);
$getTrCode = mysql_fetch_array($result);
i put this right after my last LEFT JOIN and i got errors.
now. where should i put this query? i like to use the var $getTrCode