jan-vandenberg / cruddiy

No-code Bootstrap PHP CRUD generator
http://cruddiy.com
GNU Affero General Public License v3.0
253 stars 80 forks source link

error 500 on viewing, updating and some adding #43

Closed btbuses closed 2 years ago

btbuses commented 2 years ago

error_log.txt having problems with 'viewing' and 'updating' all 3 different sets of tables, and on two of the tables, it won't allow me to 'add' (will show page, but then error 500 page on submit)

jan-vandenberg commented 2 years ago

There are two things going on: PHP Fatal error: Uncaught Error: Call to undefined function mysqli_stmt_get_result() This means your webserver host has not installed the mysqlnd driver (this is a very common package that should be installed). When you see this error, it is not installed or configured properly.

And another error is this: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails This MIGHT be because of the first error, but it might also indicate your database constraints are not properly defined.

btbuses commented 2 years ago

Thanks for your prompt reply. I'm using godaddy as the host and have been in contact with them re the first item you mentioned. On my php, it indicates that mysqlnd has been installed, and using v 7.4 of php. Screenshot_3

jan-vandenberg commented 2 years ago

nd_mysqli and nd_pdo_mysql are NOT installed.

btbuses commented 2 years ago

When i click on the two items, an error message comes up as "skipped as conflicting"

jan-vandenberg commented 2 years ago

Sorry but that is something I can not control or fix from my side. Maybe disable some other mysql modules, and try what works and what doesn't. I would be curious to know if this indeed fixes something.

btbuses commented 2 years ago

scrnshot Ok, so had a little win. Now able to view & update 2 of the sets, but there is one set where it'll list the table contents on the index page, can view a record, can open up add & update record BUT it won't allow saving of the record.

It appears the webhost has rolled me back to a much earlier version of PHP and deselected and selected different items as shown in the image here.

So not sure what to do about that one set of pages. I'm wondering if it's something in the table setup of phpmyadmin?

btbuses commented 2 years ago

G'day mate, still having issues with one set of tables. I can view the single only record that was created on my localhost, but now that it's been served live, all i can do is see the index, and you can view the record, you can go to the update record and add record pages, but when submit/saved is clicked, it still errors out. The other two sets of tables/indexes are working perfectly since the domain host changed the php extensions.

I've also redid the cruddy setup just for that one table thats giving me issues, all to no avail. Any idea why?

jan-vandenberg commented 2 years ago

Hi btbuses, it's hard for me to debug based on this information. Maybe if you can share the database (sql dumpfile) I could have a look.

btbuses commented 2 years ago

carbridge (1).sql.docx Here is the file

jan-vandenberg commented 2 years ago

https://j11g.com/carbridge/

Please try some things and I'll check the logs

btbuses commented 2 years ago

I tried: adding employee, page came up but when saving went to 500 error. viewing employee, worked. tried editing employee, page came up but saving went to 500 error.

jan-vandenberg commented 2 years ago

Aha.

TERMINATED is a reserved keyword in MySQL/MariaDB, you can not have a table or columnname with that name.

The code breaks here

$stmt = $pdo->prepare("INSERT INTO employee (name,email,phone,employee_no,commenced,terminated,position) VALUES (?,?,?,?,?,?,?)");

And my guess is because the columname is 'terminated'. Cruddiy does not (yet) do proper error checking for these cases.

btbuses commented 2 years ago

That appeared to have been the issue, never knew about reserved words. Thank you :)