How to connect DataTables using PHP and MySQL

How to connect DataTables using PHP and MySQL

YudistiraYudistira Posts: 10Questions: 4Answers: 0
edited November 2014 in Free community support

Is there anyone can help me to connect data to datatables manaully using php and mysl???

DesperateHere

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    No need to shout :-).

    All you need to do is dump the data into a JSON format, which you can do in PHP using json_encode() and an array that you would get using whatever PHP database connection method you want.

    The manual and examples show how you can use that JSON data via Ajax.

    Allan

  • YudistiraYudistira Posts: 10Questions: 4Answers: 0

    Dear Allan,

    I need complete sample from connecting database until the data is appear on the datatables using php mysql.

    I,m a newbie and a beginner please understand.

    Please your suggestion, thank you.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I would suggest using any one of the many PHP / MySQL tutorials that are available on the web to read the data from the database. Then, as I say, simply dump it to JSON.

    I would be happy to write an example for you. DataTables support packages are available and the Quick Support 60 option would cover this.

    Allan

  • YudistiraYudistira Posts: 10Questions: 4Answers: 0

    Dear Allan,

    I already try following the manual method that you sent me but the output still error.

    I attach screenshot of my work please review it, and hopefully there is a solution.

    https://www.dropbox.com/sh/9siw7ejowkdz0oi/AAAh2MQjGBCGuWgEqlaC0NZha?dl=0

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    You have bServerSide: true, but you haven't implemented server-side processing. Thats why it isn't working. See the server-side processing manual if you want server-side processing. If you don't (and you shouldn't if you are using less than 50'000 rows) remove it.

    Allan

  • YudistiraYudistira Posts: 10Questions: 4Answers: 0

    It's work Allan...hooorraayy... :)

    but what if the data equal or more than 50.000 rows in the future?
    I want there is "Processing Popup" like the example on the server-side although the data is less than 50.000 rows? please suggest the solution...thx

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    but what if the data equal or more than 50.000 rows in the future?

    Then use server-side processing. It will work just fine if you implement it.

    I want there is "Processing Popup" like the example on the server-side although the data is less than 50.000 rows?

    From the documentation: processing.

    Allan

  • YudistiraYudistira Posts: 10Questions: 4Answers: 0

    dear allan,

    everything is work fine, thank you.

    how to add edit or delete link on JSON data? with the curent code per comment above.

  • YudistiraYudistira Posts: 10Questions: 4Answers: 0

    And also my datatable.js is having confict with select2.js.

    please suggest solution.

    Regards,

    Yudistira

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    how to add edit or delete link on JSON data?

    Have a look at Editor.

    And also my datatable.js is having confict with select2.js.

    Link to a test case showing the issue please.

    Allan

This discussion has been closed.