DB Record Loader & WHERE - 1064 Error

aharsha 04 Apr, 2013
Hello.

I've looked everywhere on the site and can't seem to find anyone else who had this issue. I loaded up the DB record loader up as usual filling in the DB field (cf_uid), Table (my table name), and the Request Param (token), no Model ID, no loading from the model ID. When I go to test the form, 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=SELECT * FROM `joom_chronoforms_Property` AS `JoomChronoformsProperty` WHERE


From what I've noticed, I cannot get anything to load unless I put something in the WHERE statement box. If I just put a single digit in it, the form will run (albiet it doesn't pull up any other records). Why would that be? The description under the box says "1 - leave empty to use the default request param with column name formula ".

If that is the case, shouldn't it run based on what is on the basic tab? By adding anything to the WHERE statement, does that cancel out what is to be run on the basic tab? I am running the newest CF version on Joomla 3.0 if that helps.

Sorry, I obviously may be in over my head experience wise here but one has to cut their teeth somehow and I am flat out stuck at this point.

Thank you.
GreyHead 04 Apr, 2013
Hi aharsha,

If that is the full error then I suspect that the problem is the empty WHERE clause. Please make sure that the WHERE box is empty with not even a space in it as that might cause this problem (it shouldn't but it might).

In 2.5 it certainly works to leave the WHERE box empty, and I can see no obvious reason why it wouldn't also work in Joomla! 3.0

Bob
aharsha 04 Apr, 2013
SOLVED!!! I added a custom code line above the DB Record loader citing the "token" I needed. That fixed all those issues. Maybe I just missed that part in the tutorial but by the grace of God I somehow fished that out of two different FAQ's and it worked. I'm obviously much more lucky than I am good.

So far, Chronoforms has done everything I need it to. I have one more hurdle to cross and than I can finish my little project here. Thanks you for this product.
GreyHead 04 Apr, 2013
Hi aharsha,

The Token is usually added by putting it into the URL that calls the form with something like &token=xxx

Bob
pcheng 08 Apr, 2013
Hi,

I have a similar problem. I made two forms: one that creates an item and one that displays all items in the table. I created an Edit button on the report form and clicking on it opens the create form with the field filled in.

I used the token field and it works from the report to the create new form. The problem comes now that I try to open the create form because it gives me a 1064 error. It seems that the create new form now requires a token and cannot complete unless it finds one.

What can I do to fix this?

Thanks,

Pericles
GreyHead 10 Apr, 2013
Hi Pericles,

It sounds as though you have a WHERE clause in the MySQL query that is broken if there is no value set for the token. Is that correct?

What error do you see exactly? Does it show the MySQL query that causes the error?

Bob
pcheng 14 Apr, 2013
The error that I get is:
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 '' at line 1 SQL=SELECT * FROM `opg_chronoforms_data_frmNewSport` AS `OpgChronoformsDataFrmNewSport` WHERE

I checked the WHERE part of the Record Loader and it's empty.

Pericles
aharsha 15 Apr, 2013
Pcheng,

I was having the same issue and what I discovered is that I was getting that error when I tried to test the form from the Joomla admin screen. Once I went tom my site and tried it, it worked just fine but no matter what, I would get that 1064 error whenever I tried to test the form. I was stuck on that forever and just happened to get some dumb luck and try it outside of Joomla administration and it worked.

Hope that helps.
pcheng 16 Apr, 2013
I tried it from the frontend and again I get the same error.

Doesn't seem to work if the token is empty. If the token has something then it works. Otherwise it gives this error.

P.
aharsha 16 Apr, 2013
Do you have a seperate create a form and edit form? I found that you probably want to have a seperate one so the add form would not require the token. The edit one would work correctly for you than as it requires the token to access the correct record.

In your create a form, I don't beleive you even need the the DB record loader event. If you have that in your create a form, that may be why you are getting that 1064 error.
pcheng 16 Apr, 2013
I ended up doing what you suggested. I created separate new, edit and delete forms. It makes it harder to manage all those forms but at least they are all working. I remember in the past I used the new and edit forms with the token and it worked fine.

This is what I get for wanting to move to Joomla 3 and redesigning the forms for some extra fields.

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