Announcement

Collapse
No announcement yet.

EditableGrid how to fetch rows from MySql in php

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • EditableGrid how to fetch rows from MySql in php

    I am trying to do an editable grid table in order to modify directly.
    There is a field which I need to list all of it content so that I can select one.
    Look at my code :
    Code:
     
     function fetch_pairs($mysqli,$query){     if (!($res = $mysqli->query($query)))return FALSE;     $rows = array();     while ($row = $res->fetch_assoc()) {         $first = true;         $key = $value = null;         foreach ($row as $val) {             if ($first) { $key = $val; $first = false; }             else { $value = $val; break; }          }         $rows[$key] = $value;     }     return $rows; } $grid->addColumn('product-name', 'Product', 'string' , fetch_pairs($mysqli,'SELECT name FROM table_product'),true);
    In my database I have two tables:
    -table_add{id,product-name} -table_product{id,name}
    But the list is not appearing.
    I am getting this error:
    Could not load JSON from url 'loaddata.php?db_tablename=table_add'
    Any idea why ?

  • #2
    I don't understand how and what you are doing. If you have an editable grid then why not just make a field of type select and put the query in there?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment

    Working...
    X