Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:54:19+00:00 2026-06-04T10:54:19+00:00

I have a list and by making use of datatable plugin I sort them

  • 0

I have a list and by making use of datatable plugin I sort them clearly. Before that by php coding only I make the sorted list. And according to the current list, I can export to csv file.My code was like:

header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');



  // create a file pointer connected to the output stream
    $output = fopen('php://output', 'w');

$rows = mysql_query(base64_decode($_REQUEST['qur']));
        $number = mysql_num_rows($rows);
        if($number > 0){

            fputcsv($output, array('Name','Username','Email','Age','Location','Contact','Privilege','JoiningDate','Status'));

            // loop over the rows, outputting them
            $blankArray = array();
            while ($row = mysql_fetch_assoc($rows)) {
                $name = $row['admin_name'];
                $username = $row['username'];
                $email = $row['email'];
                $age = $row['age'];
                $location = $row['location'];
                $cont = $row['contact_no'];
                $priv = get_role_name_by_id($row['role']);
                $doj = substr($row['creation_date'],0,10);
                $status = ($row['status'] == '1')?"enable":"disable";
                $blankArray['Name'] = $name;
                $blankArray['Username'] = $username;
                $blankArray['Email'] = $email;
                $blankArray['Age'] = $age;
                $blankArray['Location'] = $location;
                $blankArray['Contact'] = $cont;
                $blankArray['Privilege'] = $priv;
                $blankArray['JoiningDate'] = $doj;
                $blankArray['Status'] = $status;

                fputcsv($output, $blankArray);

            }
        }else{
            fputcsv($output, array('No Record Found'));
        }

And from the page I was using the following piece of code:

<a href="export.php?report=user&qur=<?php echo base64_encode($search_sql); ?>"><button>Export to CSV</button></a>

Now As I change the sorting option in datatable plugin,and I use the following code :

$('#example').dataTable( {
                                "bProcessing": true,
                                "bServerSide": true,
                                "sAjaxSource": "datatabledb.php",
                                "bJQueryUI": true,
                                "sPaginationType": "full_numbers",
                                //"sDom": 'T<"clear">lfrtip',
                                "oTableTools": {
                                    "aButtons": [
                                        {
                                            "sExtends": "copy",
                                            "sButtonText": "Copy to clipboard"
                                        },
                                        {
                                            "sExtends": "csv",
                                            "sButtonText": "Save to CSV"
                                        },
                                        {
                                            "sExtends": "xls",
                                            "sButtonText": "Save for Excel"
                                        }
                                    ]
                                }                       
                            } );

But still it is not showing the button also. Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:54:21+00:00Added an answer on June 4, 2026 at 10:54 am

    You can use the TableTools that does what you need.

    See this Link! for an example and see this link for the documentation!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have list of rows that user select and i want to delete them,
I'm making a shopping list mobile application (Java ME) and i have two classes;
I have List I want to sort Desc by Priority, which is int and
I have list of catalog paths and need to filter out some of them.
Hey, I right now have a list of a struct that I made, I
I have to dynamically add a list of views (the views use RelativeLayout). Can
I have a list of strings that can contain a letter or a string
I am building a web-store that uses URL encoding extensively. I have a list
I've been trying to make my own plugin system. I have 2 separate projects.
I am making use of jQuery's .autocomplete plugin, and I would appreciate some assistance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.