Title: [Plugin: WP-Table Reloaded] Unable to implement Datatable options
Last modified: August 20, 2016

---

# [Plugin: WP-Table Reloaded] Unable to implement Datatable options

 *  Resolved [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/)
 * Hi Tobias!
 * I am a newbie in programing… and this is not my field of work but 25 years ago
   I did a lot of BASIC programing in the Spectrum 48k!
 * Now, trying to pass my huge excel database into a website for easyer use, I am
   tryng to make it happen in WordPress. Structure is made but…for more than 2 days
   i´m trying to find a way to use the Datatable Plugin.
 * I´ve found your WP-table reloaded and it seemed to fit my needs. The problem 
   now is to put my PHP code that generates my table from MySQL data into your plugin.
 * Is there a posibility?
 * I even tried to make an external page an try to import it… without success.
 * My page is here: [http://gogolfstats.com/?page_id=31](http://gogolfstats.com/?page_id=31)
 * My table page is here: [http://gogolfstats.com/tables/31.php](http://gogolfstats.com/tables/31.php)
 * My code after connection made:
 *     ```
       mysql_select_db("gogolfstats", $con);
                       $result = mysql_query("SELECT * FROM clubs");
                       echo "<table>
                       <tr>
       		    <th>Club Name</th>
       		    <th>Country</th>
       	            <th>City</th>
                           <th>Phone</th>
                       </tr>";
   
                       while($row = mysql_fetch_array($result))
                           {
                           echo "<tr align='center'>";
                           echo "<td>" . $row['Club_Name'] . "</td>";
                           echo "<td>" . $row['Country'] . "</td>";
                           echo "<td>" . $row['City'] . "</td>";
       		    echo "<td>" . "(+" . $row['Code'] . ") " . $row['Phone'] . "</td>";
                           echo "</tr>";
                               }
                           echo "</table>";
       ```
   
 * I also have a Char problem still to solve, thus the �…Grrrrrr….
 * Thanks in advance!!!!
 * [http://wordpress.org/extend/plugins/wp-table-reloaded/](http://wordpress.org/extend/plugins/wp-table-reloaded/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768643)
 * Hi,
 * thanks for your post.
 * So, the current state is that you have your data in a mySQL table? Then I have
   good and bad news:
 * Bad news: You can’t really use WP-Table Reloaded with that data, as WP-Table 
   Reloaded uses a custom data format, and no mySQL tables. And as you already have
   the mySQL table and PHP code set up, there’s no real need to try it.
 * Good news: For the advanced features (sorting, search, pagination, …) you actually
   don’t need WP-Table Reloaded. You just need to external JavaScript library “DataTables”,
   from [http://www.datatables.net](http://www.datatables.net). To integrate it,
   just follow the tutorial at [http://datatables.net/blog/Getting_started_with_DataTables%3A_First_steps](http://datatables.net/blog/Getting_started_with_DataTables%3A_First_steps).
   You might want to check out the HiFi plugin ( [http://wordpress.org/extend/plugins/hifi/](http://wordpress.org/extend/plugins/hifi/)),
   which can help to add the `<script>` tags and calls to the page header and footer.
 * Regards,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768652)
 * Thanks for the fast answer!
 * Mmmmm… I thought I had a solution with your plugin…
 * I tried that solution, with some modifications caused by WordPress with this 
   tuturial:
 * [http://datatables.net/forums/discussion/1299/apply-datatables-to-a-table-created-with-php-within-a-worpress-document./p1](http://datatables.net/forums/discussion/1299/apply-datatables-to-a-table-created-with-php-within-a-worpress-document./p1)
 * But even so I can´t do it…
 * I do all the steps and when I put the final code, inside a WP page it comes out
   an error caused by the EXE-Php Plugin…
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768660)
 * Hi,
 * no, sorry, WP-Table Reloaded is not really useful for mySQL tables.
 * Now, that solution from your link looks pretty good actually. Maybe you should
   try without a PHP-Exec-Plugin, i.e. in a WordPress page template in your theme?
 * Regards,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768661)
 * I just did a quick setup using Hifi, never used it before, but it seams great!
 * On WP Page Editor of “/?page_id=31” I put on header with HIFI:
 *     ```
       <?php
           wp_enqueue_script('jquery');
           wp_enqueue_script('jquery-ui-core');
           wp_head();
        ?>
   
       <script type="text/javascript" src="/script/jquery.dataTables.min.js"></script>
       ```
   
 * Then in Page content:
 *     ```
       Here the courses contacts:
   
       <?php $con = mysql_connect("hostname","username","password");
                       if (!$con){die('Could not connect: ' . mysql_error());}
   
                       mysql_select_db("gogolfstats", $con);
                       $result = mysql_query("SELECT * FROM clubs ORDER BY Club_Name");
                       echo "<table id='table31'>
                       <tr>
       				<th>Club Name</th>
       				<th>Country</th>
       				<th>City</th>
                       <th>Phone</th>
                       </tr>";
   
                       while($row = mysql_fetch_array($result))
                           {
                           echo "<tr align='center'>";
                           echo "<td>" . $row['Club_Name'] . "</td>";
                           echo "<td>" . $row['Country'] . "</td>";
                           echo "<td>" . $row['City'] . "</td>";
       					echo "<td>" . "(+" . $row['Code'] . ") " . $row['Phone'] . "</td>";
                           echo "</tr>";
                               }
                           echo "</table>";
   
                       mysql_close($con);
                   ?>
   
       <?php
       jQuery(document).ready(function($) {
           $("#table31").dataTable();
       });
   
       ?>
       ```
   
 * And this error comes up:
 * Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in /home/content/
   08/9386108/html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’
   d code on line 31
 * And now I did exactly the same on page “?33” except the final “magic” part:
 *     ```
       <?php
       jQuery(document).ready(function($) {
           $("#table31").dataTable();
       });
   
       ?>
       ```
   
 * And it comes out ok but without DataTables use…
 * If you can see anything I would realy apreciate!!!!
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768665)
 * How can I not use the PHP-EXE in WordPress… the pages don´t execute the code…
   I tryed that also…
 * I´m such a newbie on this!!!! 🙂
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768676)
 * Hi,
 * the
 *     ```
       jQuery(document).ready(function($) {
           $("#table31").dataTable();
       });
       ```
   
 * part is JavaScript code, and not PHP! You must not execute that as PHP, but wrap
   it in `<script>` tags and just `echo` it!
 * And yes, just pages don’t execute any PHP code (which is good). You can however
   create a page template file (in your theme), which does execute PHP (because 
   it is a plain PHP file). More on this at [http://codex.wordpress.org/Pages#Page_Templates](http://codex.wordpress.org/Pages#Page_Templates).
   
   The way with PHP-EXE should however also work.
 * Regards,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768679)
 * Thanks!!! But still can´t do it… 🙁
 * What you are saying is for me to put at the end of WP page editor this:
 *     ```
       <script> echo "
       jQuery(document).ready(function($) {
           $('#table31').dataTable();
       });
   
       "</script>
       ```
   
 * Still doesn´t work… 🙁
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768712)
 * OK… i´m so dumb… I wasn´t pointing to the right directories where the datatables
   scripts were!!!!
 * Now it´s working with some mistakes, but now I think is just tuning! Part of 
   the script is working at least.
 * Thanks for the help!!!!!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768767)
 * Hi,
 * yes, that’s what I meant with the JavaScript 🙂 And of course the folder path
   has to be correct, as the browser won’t find the file otherwise. So, really great
   to hear that it’s working now 🙂
    The remaining tweaking should just consist 
   of adjusting the options of the DataTables library in the JavaScript call.
 * Best wishes,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768776)
 * You are the best Tobias!!!
 * I read a lot of your posts (trying to solve my problem) before contacting you.
   Your knowledge clear explanation of the solutions you propose is great.
 * DataTables is really a great Plugin, How nice would it be to have a simpler form
   of using the plugin that automatically:
 * 1 – Copied the files to the correct folder.
    2 – Generated the code on the header
   of the page (like HIFI). 3 – Managed the script code of the table with on/off
   options.
 * I don´t feel this would be too dificult…
 * Anyway, many thanks again!!!!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768778)
 * Hi,
 * thanks for your feedback. It’s nice to hear that I could help!
 * About your suggestion: Don’t forget that DataTables is an external JavaScript
   library that was not written by me 🙂 I just use it with WP-Table Reloaded.
 * Having a stand-alone version of a plugin that adds DataTables is not really useful
   in my opinion. After all, you will need some place to manage that actual table
   data as well. If that’s mySQL (like in your case), you will have to do a lot 
   of custom PHP coding anyway, so adding some JS handling is doable. And for all
   others, there’s WP-Table Reloaded, which has the data editing and the various
   options of DataTables 🙂
 * Best wishes,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768779)
 * I thought about something like your WP-Table Reloaded but more advanced.
 * I tried to use your Plugin but imagine that one of the option would be to create
   a table through PHP code. Using all the same options that your plugin has… this
   would solve it.
 * Another thing is having the Datatables script options as on/off options, this
   could be done in your WP-Table Reloaded… imagine in each table creation page 
   you would have the DataTables on/off options in the lower part.
 * For a user it would be much simpler to use all the Datatables options.
 * Just thinking out loud… Cheers!!!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768780)
 * Hi,
 * I see your point, but currently I don’t feel like extending WP-Table Reloaded
   in this way. Also, creating tables through PHP code can only be done by advanced
   users, and even then, there are thousands of possibilities…
 * But still thanks for sharing your ideas, I really appreciate it!
 * Best wishes,
    Tobias
 *  Thread Starter [jpreto](https://wordpress.org/support/users/jpreto/)
 * (@jpreto)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768781)
 * Like I read more than once: Sharing is Caring!!!!
 * You´ve done a great job on sharing you knowledge and your work in WP-Table Reloaded.
 * All the best!!!!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768783)
 * Hi,
 * thanks for the kind words! Nice to hear that you like the plugin so much 🙂
 * All the best to you, too!
    Tobias

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘[Plugin: WP-Table Reloaded] Unable to implement Datatable options’ is
closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-table-reloaded_f7dcd3.svg)
 * [WP-Table Reloaded](https://wordpress.org/plugins/wp-table-reloaded/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-table-reloaded/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-table-reloaded/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-table-reloaded/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-table-reloaded/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-table-reloaded/reviews/)

 * 15 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-wp-table-reloaded-unable-to-implement-datatable-options/#post-2768783)
 * Status: resolved