Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81971

Change static data array to database query results

$
0
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>



Viewing all articles
Browse latest Browse all 81971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>