I am new to handsontable and try to learn it.
I setup local server with XAMPP to try it out.
I copy the PHP demo and change the database connection in the functions.php.
It works perfectly except loading the data from the database.
When I enter new data via handsontable it stored perfectly in the MySQL database.
But after closing when rerun the PHP demo and click on “load” button it doesn’t load any data from the data base.
I just create a MySQL database table named “cars” with four columns(‘id’,‘manufacturer’,‘year’,‘price’) and change the line $db = new PDO('sqlite:cars.sqlite');
to $db = new PDO('mysql:host=localhost;dbname=crmd', $user, $pass);
in functions.php (https://github.com/handsontable/handsontable/blob/master/demo/php/functions.php). The saving and reset functionality works fine. But “Load” is not working. Can anyone please help me to solve it out?
Hi @dassoubarna
We leave back-end all operations to devs so I’m afraid I cannot help you much but I guess that this topic at Stackoverflow can come in handy http://stackoverflow.com/questions/28311163/handsontable-how-to-load-an-array-from-a-php-server-script
Thanks any way. I’ll try by myself to find the problem following your guideline.
I have solved it out.
In functions.php the row count was in SQLITE syntax $result = $db->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='cars'");
I change it to $result = $db->query("SELECT COUNT(*) FROM cars");
in MySQL syntax and now it works like a charm.
Thank you for sharing your investigation results and a solution @dassoubarna
I’m sure it will help other users experiencing the same issue.