MoisesZaragoza Posted September 14, 2005 Share Posted September 14, 2005 I created a new page in the admin area. This page is called ordersExel.php This page contains a script that goes <?php require_once('../../Connections/myConection.php'); ?> <?php mysql_select_db($database_MaxInt, $MaxInt); $query_exelOrder = "SELECT * FROM orders"; $exelOrder = mysql_query($query_exelOrder, $MaxInt) or die(mysql_error()); $row_exelOrder = mysql_fetch_assoc($exelOrder); $totalRows_exelOrder = mysql_num_rows($exelOrder); ?> <?php $fields = mysql_num_fields($exelOrder); for ($i = 0; $i < $fields; $i++) { $header .= mysql_field_name($exelOrder, $i) . "\t"; } while($row = mysql_fetch_row($exelOrder)) { $line = ''; foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = "\t"; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } $data = str_replace("\r","",$data); if ($data == "") { $data = "\n(0) Records Found!\n"; } header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=ReportFor".date('D_F_d_Y_U').".xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?> <?php #echo (time());?> <?php mysql_free_result($exelOrder); ?> The first line <?php require_once('../..//Connections/myConection.php'); ?> Conects to my DB Everything else is a custom script that writes into a exel file. But I need a way to get information from more that one table at the time. or write a proper Query that gives me all the products in each order at the end of the day the code will be good Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.