bicyleman9008
IS-IT--Management
- May 19, 2005
- 30
I am somewhat of a beginner with php code.
I have the enclosed php program, which dumps data to the screen. I would rather save it to a csv file on the local PC.
What do I need to change and add to redirect this?
******************
<?php
include "cfg/connect.inc.php";
include("./includes/database/".DBMS.".php");
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
$q = db_query( "select orderID, customerID, order_time, customer_ip, shipping_type, ".
" payment_type, customers_comment, statusID, shipping_cost, order_amount, ".
" order_discount, currency_code, currency_value, customer_email, ".
" shipping_firstname, shipping_lastname, ".
" shipping_country, shipping_state, shipping_zip, shipping_city, ".
" shipping_address, billing_firstname, billing_lastname, ".
" billing_country, billing_state, billing_zip, billing_city, ".
" billing_address, cc_number, cc_holdername, cc_expires, cc_cvv, shippingServiceInfo ".
" from SS_orders ORDER BY orderID DESC"
);
while( $row = db_fetch_row($q) ) {
$row=array_chunk($row, 33, TRUE);
$row[1]["cc_number"]= base64_decode ( $row[1]["cc_number"]);
$row[1]["cc_holdername"]= base64_decode ( $row[1]["cc_holdername"]);
$row[1]["cc_expires"]= base64_decode ( $row[1]["cc_expires"]);
$row[1]["cc_cvv"]= base64_decode ( $row[1]["cc_cvv"]);
while (list($key, $val) = each ($row[1])) {
echo "$key => $val<br>";
}
echo "<br>";
}
?>
I have the enclosed php program, which dumps data to the screen. I would rather save it to a csv file on the local PC.
What do I need to change and add to redirect this?
******************
<?php
include "cfg/connect.inc.php";
include("./includes/database/".DBMS.".php");
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
$q = db_query( "select orderID, customerID, order_time, customer_ip, shipping_type, ".
" payment_type, customers_comment, statusID, shipping_cost, order_amount, ".
" order_discount, currency_code, currency_value, customer_email, ".
" shipping_firstname, shipping_lastname, ".
" shipping_country, shipping_state, shipping_zip, shipping_city, ".
" shipping_address, billing_firstname, billing_lastname, ".
" billing_country, billing_state, billing_zip, billing_city, ".
" billing_address, cc_number, cc_holdername, cc_expires, cc_cvv, shippingServiceInfo ".
" from SS_orders ORDER BY orderID DESC"
);
while( $row = db_fetch_row($q) ) {
$row=array_chunk($row, 33, TRUE);
$row[1]["cc_number"]= base64_decode ( $row[1]["cc_number"]);
$row[1]["cc_holdername"]= base64_decode ( $row[1]["cc_holdername"]);
$row[1]["cc_expires"]= base64_decode ( $row[1]["cc_expires"]);
$row[1]["cc_cvv"]= base64_decode ( $row[1]["cc_cvv"]);
while (list($key, $val) = each ($row[1])) {
echo "$key => $val<br>";
}
echo "<br>";
}
?>