Forums

Parse error: syntax error, unexpected '-'

elehost 23 Dec, 2008
Hello,

I wanted to post this bug when using the automatic table creation to create a table for the form data to go in if there is a dash in the table name it creates this error:

Parse error: syntax error, unexpected '-', expecting '{' in /usr/local/www/abcdefg/components/com_chronocontact/chronocontact.php(41) : eval()'d code on line 3

This traces back to the database eval script

if($paramsvalues->dbconnection == "Yes"){^M
eval ("?>".$rows[0]->dbclasses);^M
}^M

Here is the sample table name: jos_chronoforms_abc-design-submissions

I also get this error in the back end now:

DB function failed with error number 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-design-request ORDER BY cf_id LIMIT 0,20' at line 1 SQL=SELECT * FROM jos_chronoforms_abc-design-submissions ORDER BY cf_id LIMIT 0,20

Looks like I need to recreate it without the "-"🙂

Cheers,

Paul
GreyHead 23 Dec, 2008
Hi elehost,

Unless the name is quoted you can't use hypens in database table names.

Rename your form to abc_design_submissions. Then either rename the table or create a new one (and drop the old one to be tidy).

Bob
elehost 23 Dec, 2008
HI Bob,

Yes that is what I did to fix the problem as a solution. I was glad to see the program allowed me to recreate a new table even with one attached. That was great!

I made the mistake of making the actual form name with dashes and then this propagated into the creation of the table.. Woops!

I guess it is a "small bug" because it does not stop me from shooting myself in the foot :mrgreen:

Thanks for your advice.

Paul
GreyHead 23 Dec, 2008
Hi Paul,

Yes, definitely a little bug. I'm sure that Max will fix it in a future release.

You can - I think - get round it by quoting the table name but CF v3.0 won't let you edit the AutoGenerated Code either :-(

Bob
kadmis 15 Jul, 2011
Hello,Bob!

After creation of the table I have such error:

Parse error: syntax error, unexpected '-', expecting ',' or ';' in X:\home\localhost\www\roject\components\com_chronocontact\chronocontact.php(53) : eval()'d code on line 10
Спасибо за ваш заказ!
Fatal error: Call to a member function bind() on a non-object in X:\home\localhost\www\project\components\com_chronocontact\libraries\customcode.php(71) : eval()'d code on line 13

How to correct such problem?
GreyHead 15 Jul, 2011
Hi kadmis ,

You probably have a dash '-' in one of your input names. Dashes give ChronoForms and MySQL problems. Please rename the input using only [a-z], [A-Z], [0-9] or underscore '_'. No dashes, spaces or other special characters.

You will need to edit the database table column names to make sure that they still match the changed form input names.

You need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.

Bob
kadmis 15 Jul, 2011
I have not a dash '-' in my input name.
I have this input name - "order"
I renamed this input name "order" to "order_new" and the problem has disappeared🙂

Thanks, Bob!
Best regards.
GreyHead 15 Jul, 2011
Hi Kadmis,

Yes, that would cause an error. 'order' is a protected term for MySQL.

Bob
This topic is locked and no more replies can be posted.