lazymofo / datagrid

PHP MySQL CRUD Datagrid
MIT License
141 stars 57 forks source link

Trying to get demo.php working in my own project #98

Open MkMunich opened 3 months ago

MkMunich commented 3 months ago

Hi, I'm using demo.php in my project and don't get it working. May be it is an issue with my web-hoster 1blu, who restrict my to configure php; neither I'm able to install other components. As the footprint of lazy_mofo is small, I tried it. I copied over directory i18N and lazy_mofo.php. And I took the (minimal) code lines from demo.php : include('lazy_mofo.php'); // connect with pdo try { $dbh = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_user, $db_pass); } catch(PDOException $e) { die('pdo connection error: ' . $e->getMessage()); } // create LM object, pass in PDO connection, see i18n folder for country + language options $lm = new lazy_mofo($dbh, 'en-us'); Unfortunatelly, the c'tor crashes for unknown reason. I deleted all code lines inside function __construct, but this did not help. Also I tried to take out all code lines except the c'tor without success - this is very strange..

One further issue is, that phpInfo() tells me, that 'mbstring' is installed and enabled, but the test in lazy_mofo.php line 184 fails. My hope is, that I can leave out this testing. My php version is 7.4.33

lazymofo commented 3 months ago

Sorry, it's difficult for me to help without the error messages. Check your error logs or enable display of errors. Maybe that will shed some light.

ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL);

On Tue, Apr 2, 2024 at 11:53 AM MkMunich @.***> wrote:

Hi, I'm using demo.php in my project and don't get it working. May be it is an issue with my web-hoster 1blu, who restrict my to configure php; neither I'm able to install other components. As the footprint of lazy_mofo is small, I tried it. I copied over directory i18N and lazy_mofo.php. And I took the (minimal) code lines from demo.php : include('lazy_mofo.php'); // connect with pdo try { $dbh = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_user, $db_pass); } catch(PDOException $e) { die('pdo connection error: ' . $e->getMessage()); } // create LM object, pass in PDO connection, see i18n folder for country + language options $lm = new lazy_mofo($dbh, 'en-us'); Unfortunatelly, the c'tor crashes for unknown reason. I deleted all code lines inside function __construct, but this did not help. Also I tried to take out all code lines except the c'tor without success - this is very strange..

One further issue is, that phpInfo() tells me, that 'mbstring' is installed and enabled, but the test in lazy_mofo.php line 184 fails. My hope is, that I can leave out this testing. My php version is 7.4.33

— Reply to this email directly, view it on GitHub https://github.com/lazymofo/datagrid/issues/98, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRM2WDTATMHAUC544FA5VLY3L5D5AVCNFSM6AAAAABFT5SQEWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDCMRQG4YTGNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MkMunich commented 3 months ago

Many thanks Ian, I'm new to php and your hint to set the error logging was very useful. The error message gave me a hint, that my include('lazy_mofu.php'); failed, as my provider 1blu requires absolute path names. So, the first step is done and I can see my table including the last column edit&delete - great :-)

Next is, that I clicked on edit and get the error message: Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1525 Incorrect TIMESTAMP value: '0' in /hp/ap/ab/zk/www/lazy_mofu.php on line 2456 Error: HY000 Incorrect TIMESTAMP value: '0'

sql: select * from GPS where Timestamp = :identity_id arr_sql_param: Array ( [:identity_id] => 0 )

Sent From: form()

It looks like ,that an index cannot be a timestamp in lazy_mofu. I'll try to change my table definition and will report...

MkMunich commented 3 months ago

One question: is there a way to multi select rows and perform an 'action'; like UPDATE the selected rows and set a fix value to an attribute? Best regards

lazymofo commented 3 months ago

The demo.php shows the multi-update feature on the opening table grid; items are not selectable, but inputs can be displayed, "Is Active" checkbox in this case.

So I think you'd have to hack in the feature yourself like this:

-Row selection is easy, onclick toggle a class on

-If row class is present, then display a new button to show a dialog

-dialog sets the value, picks up the id's, and posts the form

On Fri, Apr 5, 2024 at 10:19 AM MkMunich @.***> wrote:

One question: is there a way to multi select rows and perform an 'action'; like UPDATE the selected rows and set a fix value to an attribute? Best regards

— Reply to this email directly, view it on GitHub https://github.com/lazymofo/datagrid/issues/98#issuecomment-2040292288, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRM2WBFMODQEJSDPAETULTY33MK7AVCNFSM6AAAAABFT5SQEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGI4TEMRYHA . You are receiving this because you commented.Message ID: @.***>