Jump to content

how i make query mysql to table


warat mookdaanan

Recommended Posts

i make form and put uniHtmlFrame and fill to html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Export a Table to Excel Template | PrepBootstrap</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css" />

    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">

<div class="page-header">
    <h1>Export a Table to Excel <small>Save HTML TABLE as Excel file</small></h1>
</div>

<!-- Export a Table to Excel - START -->
<link rel="stylesheet" type="text/css" href="/Content/font-awesome/css/font-awesome.min.css" />

<div class="container">
    <button id="exportButton" class="btn btn-lg btn-danger clearfix"><span class="fa fa-file-excel-o"></span> Export to Excel</button>

    <table id="exportTable" class="table table-hover">
        <thead>
            <tr>
                <th>Name</th>
                <th>Age</th>
                <th>Email</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>ทดสอบ</td>
                <td>36</td>
                <td>กระดาษภ่ายเอกสาร</td>
            </tr>
            <tr>
                <td>Nieves Hubbard</td>
                <td>45</td>
                <td>nieveshubbard@syntac.com</td>
            </tr>
            <tr>
                <td>Anastasia Underwood</td>
                <td>29</td>
                <td>anastasiaunderwood@gallaxia.com</td>
            </tr>
            <tr>
                <td>Maxine Haley</td>
                <td>32</td>
                <td>maxinehaley@songbird.com</td>
            </tr>
            <tr>
                <td>Bennett Alvarez</td>
                <td>44</td>
                <td>bennettalvarez@marvane.com</td>
            </tr>
            <tr>
                <td>Myrna Ellison</td>
                <td>30</td>
                <td>myrnaellison@zoxy.com</td>
            </tr>
        </tbody>
    </table>
</div>

<!-- you need to include the shieldui css and js assets in order for the components to work -->
<link rel="stylesheet" type="text/css" href="http://www.shieldui.com/shared/components/latest/css/light/all.min.css" />
<script type="text/javascript" src="http://www.shieldui.com/shared/components/latest/js/shieldui-all.min.js"></script>
<script type="text/javascript" src="http://www.shieldui.com/shared/components/latest/js/jszip.min.js"></script>

<script type="text/javascript">
    jQuery(function ($) {
        $("#exportButton").click(function () {
            // parse the HTML table element having an id=exportTable
            var dataSource = shield.DataSource.create({
                data: "#exportTable",
                schema: {
                    type: "table",
                    fields: {
                        Name: { type: String },
                        Age: { type: Number },
                        Email: { type: String }
                    }
                }
            });

            // when parsing is done, export the data to Excel
            dataSource.read().then(function (data) {
                new shield.exp.OOXMLWorkbook({
                    author: "PrepBootstrap",
                    worksheets: [
                        {
                            name: "PrepBootstrap Table",
                            rows: [
                                {
                                    cells: [
                                        {
                                            style: {
                                                bold: true
                                            },
                                            type: String,
                                            value: "Name"
                                        },
                                        {
                                            style: {
                                                bold: true
                                            },
                                            type: String,
                                            value: "Age"
                                        },
                                        {
                                            style: {
                                                bold: true
                                            },
                                            type: String,
                                            value: "Email"
                                        }
                                    ]
                                }
                            ].concat($.map(data, function(item) {
                                return {
                                    cells: [
                                        { type: String, value: item.Name },
                                        { type: Number, value: item.Age },
                                        { type: String, value: item.Email }
                                    ]
                                };
                            }))
                        }
                    ]
                }).saveAs({
                    fileName: "PrepBootstrapExcel"
                });
            });
        });
    });
</script>

<style>
    #exportButton {
        border-radius: 0;
    }
</style>

<!-- Export a Table to Excel - END -->

</div>

</body>
</html>

for download data to excel but and i don't know to show data query to my table 

<table id="exportTable" class="table table-hover">
        <thead>
            <tr>
                <th>Name</th>
                <th>Age</th>
                <th>Email</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>ทดสอบ</td>
                <td>36</td>
                <td>กระดาษภ่ายเอกสาร</td>
            </tr>
            <tr>
                <td>Nieves Hubbard</td>
                <td>45</td>
                <td>nieveshubbard@syntac.com</td>
            </tr>
            <tr>
                <td>Anastasia Underwood</td>
                <td>29</td>
                <td>anastasiaunderwood@gallaxia.com</td>
            </tr>
            <tr>
                <td>Maxine Haley</td>
                <td>32</td>
                <td>maxinehaley@songbird.com</td>
            </tr>
            <tr>
                <td>Bennett Alvarez</td>
                <td>44</td>
                <td>bennettalvarez@marvane.com</td>
            </tr>
            <tr>
                <td>Myrna Ellison</td>
                <td>30</td>
                <td>myrnaellison@zoxy.com</td>
            </tr>
        </tbody>
    </table>

 

export excel.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...