Forums

SQL issue and question

fp25 19 Mar, 2014
Hello !
I'm currently testing Chronoforms, and I have an issue with the export database function.
I made some entries in my form table, and when I want to export an entry, here is the issue I encounter :

 0 SQL=SELECT `ListData`.`created` AS `ListData.created`, `ListData`.`AdresseMac1` AS `ListData.AdresseMac1`, `ListData`.`TypeMateriel1` AS `ListData.TypeMateriel1` FROM `InscriptionMateriel` AS `ListData` WHERE = '{ListData.id}'


I looked in PhpMyAdmin and my entries are present in the table.
Do you have any idea about where does this issue could come from ?

(Also, as I looked in PhpMyAdmin, I looked at my entries and I saw that dropdown values are registred as "0", "1", ...
Is it possible to register them as the value the user selected ?)

Thank you very much for your help.
fp25 20 Mar, 2014
Hi,
Any help would be greatly appreciated🙂

Thanks again !
fp25 20 Mar, 2014
Hi again,
I may have found what's wrong (maybe😀).
I went to phpMyAdmin to test the SQL request mentionned in the error. It returned this error :

#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 '= '{ListData.id}' LIMIT 0, 30' at line 1



I tried to delete the "=" and no error is returned.
But it indicates that MySQL has returned an empty result, even if there's data in my table.

Thank you in advance for your help.
GreyHead 20 Mar, 2014
Hi fp25,

It looks like the WHERE clause doesn't include any value to test?

Instead of WHERE = '{ListData.id}' it should presumably be something like: WHERE `id` = '{ListData.id}'

I have no idea how this works in CFv5 though - you'd need to ask Max that :-(

Bob
fp25 20 Mar, 2014
Hi GreyHead,
Thank you for your answer.

I tried to set only one column to export in the "CSV Export" action.
Then, the export works perfectly.

I assume there's an issue, either in the "CSV Export" configurator, either with me, when giving columns to be retrieved in the table. I tried several formulas with different separators between the names of the columns :

column1, column2
column1,column2
"column1","column2"
"column1", "column2"
etc.

Maybe there's a special syntax to enter and to separate columns' name ?

Thank you in advance for your help.
fp25 20 Mar, 2014
Seems like it's a deeper issue, here is the issue I encounter when trying to delete some table entries on Chronoforms :

0 SQL=DELETE FROM `InscriptionMateriel` WHERE IN ('{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}', '{ListData.id}');

fp25 20 Mar, 2014
Answer
Well, I think I found what was the issue ...
PBKAC !

When I was creating a table for a form, I unchecked "id" row, which is a primary key.
By checking it, I have no more SQL issues.

I also found the answer about dropdown table entries. I simply deleted the numbers in front of each list item.

Thank your, for your help, GreyHead.
This topic is locked and no more replies can be posted.