I have a problem how can I use slick grid, it does not have a documentation on how to use it with PHP so I made mine. But I ran into a problem. How would I echo my MySql Query to look like this:
$(function () {
for (var i = 0; i < 500; i++) {
var d = (data[i] = {});
d["title"] = "Task " + i;
d["description"] = "This is a sample task description.\n It can be multiline";
d["duration"] = "5 days";
d["percentComplete"] = Math.round(Math.random() * 100);
d["start"] = "01/01/2009";
d["finish"] = "01/05/2009";
d["effortDriven"] = (i % 5 == 0);
}
This is from the slick grid and I need to make my query turn out to be like this. I don't know would I use json_encode
or what? I tried the answer in This older Post but I cannot make it run any advice.
By the way here is my table just in case. .
CREATE TABLE IF NOT EXISTS `city` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` char(35) NOT NULL DEFAULT '',
`CountryCode` char(3) NOT NULL DEFAULT '',
`District` char(20) NOT NULL DEFAULT '',
`Population` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `CountryCode` (`CountryCode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4083 ;
my query is just select * from city;
i just needed to echo out, here is my code :
$(function () {
for (var i = 0; i < 500; i++) {
var data=[];
<?php echo $data ?>
}
The answer was taken from THIS POST i just needed to echo it out