Hi all,
I refer to this fantastic example (http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdragdrop/index.htm?%28classic%29#demos/jqxdragdrop/defaultfunctionality.htm) that with a manual array works, with JSON works, but if I wanted to use a mysql db directly as I do?
This is my code but it does not work:
…
var source =
{
datatype: “json”,
datafields: [
{ name: “name” },
{ name: “pic” },
{ name: “price” }
],
url: “grid_data2.php”,
cache: false
};
ecc…
and grid_data2.php is like this:
…
$result = mysql_query($query) or die(“SQL Error 1: ” . mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$products[] = array(
‘name’ => $row[‘name’],
‘pic’ => $row[‘pic’],
‘price’ => $row[‘price’]
);
}
echo json_encode($products);
Thank you.
Andrea.