Results 1 to 3 of 3

Thread: การส่งออกข้อมูลเข้าสู่ Ms Excel ด้วย PHP

  1. #1


    Lightbulb

    การส่งออกเข้า Ms Excel จะส่งออกในรูปแบบของไฟล์ csv และสามารถเปิดด้วย
    โปรแกรม Microsoft Excel ลองมาดูตัวอย่างกันหน่อยนะครับ

    ชื่อฐานข้อมูล mydatabase
    รายละเอียดของตาราง

    CREATE TABLE `testing` (
    `id` int(3) NOT NULL auto_increment,
    `question` varchar(100) NOT NULL default '',
    `c1` varchar(100) NOT NULL default '',
    `c2` varchar(100) NOT NULL default '',
    `c3` varchar(100) NOT NULL default '',
    `c4` varchar(100) NOT NULL default '',
    `answer` int(1) NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=11 ;

    #
    # dump ตาราง `testing`
    #

    INSERT INTO `testing` VALUES (1, 'ข้อที่ 1', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 1);
    INSERT INTO `testing` VALUES (2, 'ข้อที่ 2', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 2);
    INSERT INTO `testing` VALUES (3, 'ข้อที่ 3', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 3);
    INSERT INTO `testing` VALUES (4, 'ข้อที่ 4', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 4);
    INSERT INTO `testing` VALUES (5, 'ข้อที่ 5', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 4);
    INSERT INTO `testing` VALUES (6, 'ข้อที่ 6', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 3);
    INSERT INTO `testing` VALUES (7, 'ข้อที่ 7', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 2);
    INSERT INTO `testing` VALUES (8, 'ข้อที่ 8', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 1);
    INSERT INTO `testing` VALUES (9, 'ข้อที่ 9', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 2);
    INSERT INTO `testing` VALUES (10, 'ข้อที่ 10', 'ตัวเลือกที่ 1', 'ตัวเลือกที่ 2', 'ตัวเลือกที่ 3', 'ตัวเลือกที่ 4', 3);


    Sample1.php

    **Hidden Content: To see this hidden content your post count must be 6 or greater.**

  2. #2


    หาตั้งนาน ขอบคุณมากนะครับ ไม่ได้อันนี้แย่เลย

  3. #3
    Junior Member
    Join Date
    Jan 2009
    Posts
    4


    ออกมาเป็น csv ใช้โปรแกรมพวกโลตัสเปิดก็ได้นะครับ

    จริงๆแล้วตัว phpmyadmin ก็ทำได้นะครับ

Similar Threads

  1. Replies: 2
    Last Post: 16-02-2010, 03:24 PM
  2. คู่มือการใช้ Excel เป็นไฟล์ Excel.xls
    By korakhot in forum Computer Tip & Trick / Tutorial
    Replies: 0
    Last Post: 03-05-2008, 07:58 AM
  3. Excel : Notepad เสนอหน้าเปิดไฟล์ Excel
    By musashishime in forum ข่าวสารด้าน IT ใหม่ๆ
    Replies: 0
    Last Post: 18-04-2008, 06:29 PM
  4. การสร้างไฟล์ Excel ด้วย ASP
    By tonhor in forum PHP,ASP,Javascript, Html
    Replies: 1
    Last Post: 19-07-2007, 04:14 PM
  5. Replies: 0
    Last Post: 05-12-2006, 08:06 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •