Forums

You have an error in your SQL syntax

ultrasonicTim 30 Dec, 2010
I've searched and found this topic before but this is maybe a little different in my case? I am getting this error when I click on the table connected to a form and then select the first record and click delete. I added a test record to test the DB connectivity to my form and then wanted to delete this lone record but I get the following error:

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 ')' at line 1 SQL=DELETE FROM jos_chronoforms_naram53 WHERE cf_id IN ()

I believe I am using the latest version of Chronoform (although I couldn't find the version listed anywhere) and I am running the latest Joomla 1.5.22. My hosting company uses MySQL5.0.

What am I doing wrong??

Thanks,

Tim
GreyHead 31 Dec, 2010
Hi Tim,

There is no record ID in the SQL statement. This should be picked up from the checkboxes to the left of the record labels.

It seems to be working OK here. Looking at the Page Source the code for the Checkbox is
<input type="checkbox" onclick="isChecked(this.checked);" value="2_10" name="cid[]" id="cb0">
though your value may be different.

Bob
ultrasonicTim 02 Jan, 2011
Mine appears to be a little different. Maybe I do have an old version?

<input type="checkbox" id="cb0" name="cid[]" value="_1" onclick="isChecked(this.checked);" />


Tim
GreyHead 02 Jan, 2011
Hi Tim,

You may have an earlier version but the result looks more or less the same except that the cid is missing the first digit compared to mine. Do the rest of the records have the same _99 format or do they look like 9_99??

Bob
ultrasonicTim 02 Jan, 2011
I added a second record and the id appears to increment but both have the same "value=_1".

<input type="checkbox" id="cb0" name="cid[]" value="_1" onclick="isChecked(this.checked);" />
<input type="checkbox" id="cb1" name="cid[]" value="_1" onclick="isChecked(this.checked);" />
GreyHead 02 Jan, 2011
Hi Tim,

Odd . . . does your table have a Primary Key set? I wonder if that is the problem here.

Bob
ultrasonicTim 02 Jan, 2011
No it does not. I guess that's important after all. :wink: Sorry about that. I added cf_id back into the database and set it as the primary key. Now deleting from the backend works just fine. Check that one off to my inexperience. Thanks again for your help.

Tim
GreyHead 02 Jan, 2011
Hi Tim,

No problem. ChronoForms (and the Joomla! db code it uses) depends on their being an integer primary key. It doesn't have to be called 'cf_id' but there does need to be a key for the DB Connection and DB edit/delete to work.

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