This is a migrated thread and some comments may be shown as answers.

Unable to set datasource to mysql db Northwind

1 Answer 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
skunkies
Top achievements
Rank 1
skunkies asked on 31 Oct 2014, 10:19 AM
Hi I use the following code to connect my grid to my db but I don't get any result.
Can anyone help?

<?php
 
require_once '../lib/DataSourceResult.php';
require_once '../lib/Kendo/Autoload.php';
 
$request = json_decode(file_get_contents('php://input'));
 
header('Content-Type: application/json');
 
$result = new DataSourceResult('mysql:host=localhost;dbname=kendo', 'cc_user_ws', 'test1234');
 
$columns = array('ProductID', 'ProductName', 'UnitPrice', 'UnitsInStock', 'Discontinued');
 
$result = $result->read('Products', $columns, $request);
 
echo json_encode($result);
 
?>

Result of the page is : 
{"total":0,"data":[]}

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 04 Nov 2014, 09:40 AM
Hello Skunkies,

The code that you shared looks as it should be and we are not sure what is the issue, to see what exactly is going wrong we will need a small demo or example to investigate on.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
skunkies
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or