Search

Ok this little issue threw me for a loop.

I have a front end form that pulls in an entry so it can be edited and then saved back.

Had it working all quite well, recently I started to style the site and then that’s when all the issues started to pop up. Why I don’t know, but anyway I’m getting this error/warning in the symphony log file.

2010/01/28 12:26:16 > WARNING: 512 - MySQL 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 ‘AND f.id IN (‘6’) LIMIT 1’ at line 4 in query “SELECT f.id AS field_id FROM sym_fields AS f LEFT JOIN sym_sections AS s ON f.parent_section = s.id WHERE s.id = AND f.id IN (‘6’) LIMIT 1” in file /Sites/code/symphony/lib/toolkit/class.mysql.php on line 401

The form pulls in the data just fine. But when the data is edited and submitted. It no longer updates on the back end. And also make the entry completely disappear from the xml in the datasource. But the entry does still exist in the backend unedited. If I re-save the entry from the backend it reappears in the xml again.

Help! :)

I presume you mean you’re updating entries via frontend events? Can you post an example of the HTML of your form post?

Yes exactly. Here is the xsl and below that is the html

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="../utilities/master.xsl"/>

<xsl:template match="data">

<form action="?debug" method="post" enctype="multipart/form-data" class="snip" id="editSnip">

<input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
<input name="id" id="{$entry}" type="hidden" value="{$entry}" />

  <fieldset>
      <h1>Edit Code</h1>

      <label>Title</label>
          <input type="text" name="{entry/@id}" value="{code/entry/title}"/>

            <input name="fields[date]" type="hidden" value="{$today} {$current-time}" />

      <label>Descriptions</label>
      <textarea id="fields-body" name="fields[body]">
            <xsl:value-of select="code/entry/body" />
      </textarea>

      <label>Code</label>
      <textarea id="fields-code" name="fields[code]">
            <xsl:value-of select="code/entry/code" />
      </textarea>

            <label>Category</label>
            <select multiple="multiple" id="fields-categories" name="fields[categories][]">
                <xsl:choose>
                    <xsl:when test="code/entry/categories/item[@handle = 'html']">
                            <option value="HTML" selected="selected">HTML</option>
                    </xsl:when>
                    <xsl:otherwise>
                        <option value="HTML">HTML</option>
                    </xsl:otherwise>
                </xsl:choose>

                <xsl:choose>
                    <xsl:when test="code/entry/categories/item[@handle = 'javascript']">
                                <option value="Javascript" selected="selected">Javascript</option>
                    </xsl:when>
                    <xsl:otherwise>
                            <option value="Javascript" >Javascript</option>
                    </xsl:otherwise>
                </xsl:choose>



  </fieldset>

    <input name="action[edit-code]" type="submit" value="Submit" />
    <input name="action[delete]" type="submit" value="Delete" />

</form>

</xsl:template>


</xsl:stylesheet>

And the Rendered HTML

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Code  — edit</title>
    <link rel="icon" type="images/png" href="http://local-code/workspace/images/icons/bookmark.png" />
    <link rel="stylesheet" type="text/css" media="screen" href="http://local-code/workspace/css/global.css" />
    <link rel="alternate" type="application/rss+xml" href="/rss/" />
  </head>

  <body>
    <div id="masthead">
      <h2 id="logo">
        <a href="http://local-code" class="gl">Code <span></span></a>
      </h2>
      <ul id="navigation">
        <li>
          <a href="http://local-code/add/">add</a>

        </li>
      </ul>
    </div>
    <div id="content">
      <form method="get" action="/search/" id="search">
        <div>
          <input type="text" name="q" id="question" />
          <button type="submit" id="submitBtn">Search</button>

        </div>
      </form>
      <form action="?debug" method="post" enctype="multipart/form-data" class="" id="edit">
        <input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
        <input name="id" id="61" type="hidden" value="61" />
        <fieldset>
          <h1>Edit</h1>
          <label>Post title</label>

          <input name="fields[title]" type="text" value="test" />
          <input name="fields[date]" type="hidden" value="2010-01-29 11:32" />
          <label>Descriptions</label>
          <textarea id="fields-body" name="fields[body]">test more</textarea>
          <label>Code</label>
          <textarea id="fields-code" name="fields[code]">some code</textarea>
          <label>Category</label>

          <select multiple="multiple" id="fields-categories" name="fields[categories][]">
            <option value="HTML" selected="selected">HTML</option>
            <option value="Javascript">Javascript</option>
          </select>
        </fieldset>

        <input name="action[edit-code]" type="submit" value="Submit" />
        <input name="action[delete]" type="submit" value="Delete" />
      </form>

    </div>

  </body>
</html>

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details