Unable to set datasource to mysql db Northwind

2 posts, 0 answers
  1. skunkies
    skunkies avatar
    10 posts
    Member since:
    Sep 2014

    Posted 31 Oct 2014 Link to this post

    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":[]}
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 04 Nov 2014 Link to this post

    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!
     
  3. UI for ASP.NET AJAX banner
Back to Top