How to connect DataTables using PHP and MySQL
How to connect DataTables using PHP and MySQL
Yudistira
Posts: 10Questions: 4Answers: 0
This question has accepted answers - jump to:
This discussion has been closed.
Answers
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
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.
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
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
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
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
Then use server-side processing. It will work just fine if you implement it.
From the documentation:
processing
.Allan
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.
And also my datatable.js is having confict with select2.js.
please suggest solution.
Regards,
Yudistira
Have a look at Editor.
Link to a test case showing the issue please.
Allan