1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?
require_once("connect.php");
$conn = ora_logon(LOGIN."@".INSTANCE,PASSE);
$requete=" select no_demande, date_demande, lib_type, description, no_niveau,".
" nom_util, pnom_util, d.direction, d.service, cout_achat, cout_fonct, commentaire, rownum rang,u.codcol,u.no_util, d.demande_bp".
" from demande d, utilisateur u, typ t".
" where d.no_util=u.no_util".
" and d.no_type=t.no_type ".
" order by no_demande asc ";
$v_open = ora_open($conn) or die ('Could not connect.'.ora_error());
$v_parse = ora_Parse($v_open, $requete);
$v_execute = ora_Exec($v_open) or die ('<br>Execution not made. SELECT : '.ora_error());
$data="";
function format($string)
{
$suppr = array("\n", ";" );
return str_replace($suppr, "", $string);
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=test.csv");
header("Pragma: no-cache");
header("Expires: 0");
while(ora_fetch($v_open))
{
echo ora_getcolumn($v_open,0).";".ora_getcolumn($v_open,1).";".ora_getcolumn($v_open,2).";".format(ora_getcolumn($v_open,3)).";".ora_getcolumn($v_open,4).";".ora_getcolumn($v_open,5).";".ora_getcolumn($v_open,6).";" ."\n";
}
?> |
Partager