trying to export to excel using PHP and Oracle 9i

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harljef
    New Member
    • Jan 2007
    • 3

    trying to export to excel using PHP and Oracle 9i

    I need help with a PHP script code that could export to excel from a Oracle database I am using PHP4
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Originally posted by harljef
    I need help with a PHP script code that could export to excel from a Oracle database I am using PHP4
    From your request I assume that you already have some code done. Show it.

    Ronald :cool:

    Comment

    • harljef
      New Member
      • Jan 2007
      • 3

      #3
      Originally posted by ronverdonk
      From your request I assume that you already have some code done. Show it.

      Ronald :cool:
      This is a part of my code, I am connecting to Oracle but I need to export the query I got to a xls file.

      <tr>
      <th height="54" scope="col">

      <p align="left"><s trong>Plazo</strong>:
      <?
      $db_conn=ocilog on("web","web", "maprd1_solaris ") or die("No he podido conectar");
      ?>

      <select name="plazob" id="plazob" value=<?=$plazo ?>>

      <?
      $cmdst1 = "select * from plazos where codigo=$plazo";
      $plazo1 = ociparse($db_co nn, $cmdst1);
      ociexecute($pla zo1);

      while(OCIFetch( $plazo1)) {
      ?>
      <option value="<?=ocire sult($plazo1,1) ?>">
      <?=ociresult($p lazo1,2)?>
      </option>
      <? }?>
      </select>
      </p>


      </th>
      </tr>

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        There is a free class at ADODB SQL 2 Excel .
        This class can be used to generate Excel files in the XLS format from database query results.

        Ronald :cool:

        Comment

        • harljef
          New Member
          • Jan 2007
          • 3

          #5
          Ronald

          Thank you for your help, but what I need actually is pass the info of a php file to a xls file for example if I am making a oracle database query like this

          <p align="left"><s trong>Plazo</strong>:
          <?
          $db_conn=ocilog on("web","web", "maprd1_solaris ") or die("No he podido conectar");
          ?>

          <select name="plazob" id="plazob" value=<?=$plazo ?>>

          <?
          $cmdst1 = "select * from plazos where codigo=$plazo";
          $plazo1 = ociparse($db_co nn, $cmdst1);
          ociexecute($pla zo1);

          while(OCIFetch( $plazo1)) {
          ?>
          <option value="<?=ocire sult($plazo1,1) ?>">
          <?=ociresult($p lazo1,2)?>
          </option>
          <? }?>
          </select>
          </p>


          be able to pass the value of plazo to a cell of a xls file

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            You either want to make a new file or update an existing one. See the following classes for that (otherwise try the XML group at phpclasses.org) :
            Excel Writer
            This class can generate spreadsheet files in the .xls XML format used by the latest versions of Microsoft Excel.

            The class can generate spreadsheet files writing a whole rows at once, or individual row cells one at a time.
            Excel XML Parser
            This package can be used to read and write data to Excel worksheets in the Excel XML format.

            It can parse an Excel document file in the XML format and create objects to access the file workbook, worksheets, table, cells, etc..

            The contents of the document may also be altered and saved to an Excel XML file or served for download.
            Ronald :cool:

            Comment

            Working...