jQWidgets Forums

jQuery UI Widgets Forums Grid Bind jqxGrid to Postgres Database using PHP

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  bigears 12 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Bind jqxGrid to Postgres Database using PHP #9801

    bigears
    Member

    Hi

    I got jqxGrid to bind to mysql database just fine. I have done the following changes to the data.php to see if I can get the same results from a Postgresql database.

    Changes:

    //include(‘connect.php’);
    $connect = pgsql_connect(“host=localhost dbname=xxxx user=xxxxx password=xxxxx”) or die(‘Could not connect: ‘ . pg_last_error());
    //select database
    //mysql_select_db($database, $connect);
    //Select The database
    //$bool = mysql_select_db($database, $connect);
    //if ($bool === False){
    //  print “can’t find $database”;
    //}
    // get data and store in a json array
    $query = “SELECT firstname,lastname,dob,address1,city FROM customers”;
    $from = 0;
    $to = 30;
    //$query .= ” LIMIT “.$from.”,”.$to;
    $query .= ” LIMIT “.$to;

    $result = pg_query($query);
    while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
    $customers[] = array(
    ‘CompanyName’ => $row[‘firstname’],
    ‘ContactName’ => $row[‘lastname’],
    ‘ContactTitle’ => $row[‘dob’],
    ‘Address’ => $row[‘address1’],
    ‘City’ => $row[‘city’]
    );
    }

    As far as I can tell this should connect and bring back the results, but it show “no data to display”

    Am I missing something. I would appreciate some help.

    Regards


    Peter Stoev
    Keymaster

    Hi bigears,

    Unfortunately, I can’t tell what this page returns as a result. If it returns data in ajax function’s callback when you call the data.php from ajax, the Grid should display it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    bigears
    Member

    I sorted it out with Postgres. Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.