Change static data array to database query results

Change static data array to database query results

hello001hello001 Posts: 3Questions: 0Answers: 0

Hello, I created a DataTables jQuery table that worked good using a static data array. But I now need to use database query results. I have little experience with javascript, I just need to get this one search page to work. Thanks so much for any help...


<?php $connect = mysqli_connect("localhost", "user123X", "pass123X", "page_list"); $query ="SELECT * FROM page_list ORDER BY page_name"; $result = mysqli_query($connect, $query); ?>
<!DOCTYPE html>
<html>
<head>


<link rel="stylesheet" type="text/css" href="DataTables-1.10.16/css/jquery.dataTables.min.css"/>

<style type="text/css">
</style>
<title>DataTables</title>

$(document).ready(function() { $('#page_list').dataTable({ "ajax": 'array.txt', "columns": [ { "data": "page_name" }, { "data": "page_url", "render": function(data, type, row, meta){ if(type === 'display'){ data = 'More Info' } return data; } } ] }); });//]]>

</head>
<body>

Top of html...

 

table<br>

Page Name

Page url

</body>
</html>


Replies

This discussion has been closed.