Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditableGrid how to fetch rows from MySql in php #44

Open
TatsuSheva opened this issue Mar 29, 2017 · 0 comments
Open

EditableGrid how to fetch rows from MySql in php #44

TatsuSheva opened this issue Mar 29, 2017 · 0 comments

Comments

@TatsuSheva
Copy link

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 :
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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant