1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Form submit throwing MySQL error

Discussion in 'Community' started by pastvne, Apr 2, 2020.

  1. pastvne

    pastvne Bruce Decker

    Level: Community
    I have a form which contains some joins with some groups hidden.
    When I save a record, it saves and does no harm to other tables but it displays this message:

    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3

    I've unpublished all list and form plugins and still this persists

    I've tried adding ?fabrikdebug=1 to my forms URL and re-loading it but I don't get additional debug info.

    How can I trigger better debug info on form submit so I can see what is throwing this error message?

    Or, what else could I look at?

    Thanks,
    Bruce
     
  2. juuser

    juuser Active Member

    Level: Community
    Hi, have you enabled "Fabrik debug" in Fabrik options?
     
  3. pastvne

    pastvne Bruce Decker

    Level: Community
    Yes, I have that option set. The problem is that I'd like to see what is happening between the time that I press submit and when the list re-displays with the error shown above, above the list header block. I've tried appending ?fabrikdebug=1 to the URL for the form and then reloading it with that appended. But when I press submit, it operates as if there is no debug, probably because the list refresh has taken over. I can't for the life of me figure out where that bad MySQL syntax error is coming from. I've tried turning off all LIST and FORM plugins to see if it would go away. But my plugins require the fields in the join in order to function. I've thought of removing the join and just coding the queries in my plug-in but was hoping to avoid that since it would be far less efficient to do it that way across a large set of records. If I could just get a tip about how to see some trace or debug info from the point where the submit button is pressed to the point of the list redisplaying with that error at the top, I'm sure I could figure it out.
     
    Last edited: Apr 2, 2020
  4. juuser

    juuser Active Member

    Level: Community
    Disable groups one by one until the problem disappears. When you have found the "problem" group, enable it, disable all the elements in the group and start enabling them one by one until you have found the "faulty" element.

    After the element is found, the problem can be usually fixed quite easily.

    That all stands if the problem is within some element which it very likely is.
     
    troester likes this.
  5. troester

    troester Well-Known Member Staff Member

    Level: Community
    Is this with adding a record and/or editing an existing record?
    Are all elements used for joining published, writeable?
    Try to add a redirect plugin to your form so it won't reload the list -> is there any error?
     
  6. pastvne

    pastvne Bruce Decker

    Level: Community
    Hi Troester, it is only when adding a new record. All of the elements in the main list and the joined list are published. I will try to add the re-direct as you suggest. II'm going to do a git update just to be sure I'm on the latest and then I'll follow these suggestions and report back. Much appreciated!
     
  7. troester

    troester Well-Known Member Staff Member

    Level: Community
    If it's only with new records I assume some key which should store the parent id is empty (error ...near ''....)
    Do you have complex joins?
    Enable Joomla system debug. This should show the complete query + the call stack.
     
  8. pastvne

    pastvne Bruce Decker

    Level: Community
    Thanks Troester. I did the github upgrade and I'm getting a little more information in the error that I think may lead me to an issue in my eval code. I had turned on all debugging (J! and F!) but not seeing the form update query generated by F!. It may not be necessary and I suspect that I'm now being pointed to the eval code on an element that may fit nicely into your theory.
    Thanks again for the help. I'll report back.
    -BD
     
  9. pastvne

    pastvne Bruce Decker

    Level: Community
    Posting this to close out the thread. I never did get to the root cause of this but I did discover that if I removed my join completely that I didn't have the error when submitting the form. So, I did a work-around to copy my list that contained the join (necessary for the list display) to a new list then, in the new list, I removed the join. Then I linked my edit and add form from the un-joined list to the custom edit url of the list containing the join. Now it operates without tossing the error. I did have a need for access to some of the joined fields in my form's evals and plug-ins but I'll just add queries to those code snips. Since those pieces of code only get executed when processing a form, and not with the list rendering, there should not be a noticeable performance impact.
     

Share This Page