-
Notifications
You must be signed in to change notification settings - Fork 103
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
Help needed on insert statement #161
Comments
That's a mistake on my part, it should be |
Alternatively, you can use |
Thanks for your quick help, but I get a different error with that approach Could this be because of my PHP version 8? |
No, PHP 8 should be fine. I think you forgot to add columns & values.
|
Here is the response when I vardump $user_attributes
Maybe I will sleep and get back to my code when I wake up. Maybe I spelt a field name wrongly. |
@kwhat Here is the result of the insert statement But when I add the ->execute(), it now fails with the error But... when I use the PDO directly, it works!
I am really confused! |
Can you send me the snippet for the code you are using? |
Sorry for the delayed response. This is a freelance project and I had to deliver with what worked first - to avoid late delivery penalty from the platform. Here's the form content - styled in bootstrap4 css
Here is the processor page
|
Here is a fresh installation made just to find out if I did something wrong in the previous code... and it shows same error.
Please review and help. |
Downgrading to version 2,1,0 makes the code work! So, here is what I have come up with:
I am not able to help check the source code haha as I am just migrating from procedural PHP to OOP and everything is still looking foreign to me. |
It is def a documentation problem:
|
What ended up happening is that instead of taking in pairs, I had to take in columns to support adding multiple inserts in a single query and I totally spaced on updating the docs. |
I just updated the docs, I'm wondering if I should have kept it backward compatible with 2.1 now. |
Thanks for updating the docs. Making it backward compatible is nice, but just keeping a copy of the docs for the older version will do as well ~ my thoughts. |
I followed the guide here https://github.com/FaaPz/PDO/blob/2.x/docs/Statement/Insert.md to make an insert page.
$user_insert = new Insert($dsn, $user_attributes)->into('users');
but I get error
Parse error: syntax error, unexpected token "->" in app\includes\functions\auth.php on line 57
I dont know if I have missed anything, but please help me.
Thank you for your help!
The text was updated successfully, but these errors were encountered: