syntax error, unexpected token "=", expecting ")"
Any idea of what could go wrong ?
Here is the hook :
add_action('frm_after_create_entry', 'copy_into_my_table', 30, 2);I've reviewed your code and find no errors. The problem you're experiencing is probably not originating with this code. The code is written correctly and does not produce errors when run through a PHP Lint checker for PHP versions 7.4 and 8.2. This code should work for all PHP versions from 7.4 and later. This means that either the WP Code plugin or your data is at fault, if its execution gets far enough to actually parse $_POST. I'm not familiar with WP Code. I would try the Code Snippets plugin, which is what I use, or adding the code directly to functions.php. Code Snippets flags syntax errors as you type. If it still produces errors, you'll need to enable WordPress debug to try to isolate a line number for the error. The 'syntax error, unexpected token "=", expecting ")"' tells us that WP Code is detecting something wrong but is not identifying where as in which line. Have you opened a support ticket with the WP Code developers?
Thank you for your help. I opened a ticket at WP Code, I'm waiting for their answer. But it seems that even directly in functions.php, not all entries get copied in the other database table. There must be something wrong somewhere. I'm gonna try to turn the debug mode on and see what happens.
It gets me this, not sure to understand :
[30-Dec-2022 12:52:07 UTC] PHP Fatal error: Cannot redeclare copy_into_my_table() (previously declared in /home/u140737336/domains/team-ot.net/public_html/wp-content/plugins/wpcode-premium/includes/class-wpcode-snippet-execute.php(268) : eval()'d code:2) in /home/u140737336/domains/team-ot.net/public_html/wp-content/plugins/wpcode-premium/includes/class-wpcode-snippet-execute.php(268) : eval()'d code on line 2
You're getting this because the snippet is still active in WP Code. Functions can only be declared 1 time in a system. It was declared in WP Code before functions.php loaded.
My last message wasn't clear but I got this in the log before to put the code in the functions.php file, so there's really something wrong with the WP Code plugin. Since the moment I deactivated WP Code and placed my snippet directly in functions.php everything is going fine. I had a problem with some entries not being posted to the database but I discovered it was the fault of a field in my form. Now everything works like it should. Thanks for your help Victor.
Please login or Register to submit your answer