Jump to content

Search the Community

Showing results for tags 'export to csv from oracle db'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. The below code is not stamping the table rows to CSV, I get empty CSV download file.. pls help <?php $conn = oci_connect('uid', 'pass', '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SID=database)))'); if (!$conn) { $e = oci_error(); echo("<br/>".$e); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, 'SELECT server,ipaddress FROM table where rownum<=50 order by kill_time desc '); if (!$stid) { $e = oci_error($conn); echo($e); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Perform the logic of the query $r = oci_execute($stid); if (!$r) { $e = oci_error($stid); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Fetch the results of the query $ncols = oci_num_fields($stid); echo "<tr>\n"; for ($i = 1; $i <= $ncols; ++$i) { $colname = oci_field_name($stid, $i); } // Query Database $filename = 'file.csv'; $out = ''; // fiels to export $out .='server, ipadress'; $out .="\n"; // Add all values in the table while ($l = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { for ($i = 0; $i < 2; $i++) { $out .=''.$l["$i"].','; } $out .="\n"; } // Output to browser with appropriate mime type header("Content-type: text/x-csv"); header("Content-Disposition: attachment; filename=$filename"); echo $out; exit; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.