Search

Attempting to update all entries of a field-type named 'updated' on a section which is selected in the XML importer module.

As all entries need resetting to 'no' before the entries are parsed from XML feed to the DB I thought a simple MySQL would be efficient after finding the correct section and field ID.

        $sectionManager = new SectionManager(Symphony::Engine());
        $section = $sectionManager->fetch($options['section']);

        // Mark the updated field
        if ($options['mark-updated'] == 'yes'){

            $fields = $section->fetchFields('updated');

            foreach($fields as $field){
                //var_dump($updated);
                $updated = $field->get("id");

                Symphony::Database()->query("
                    UPDATE `sym_entries_data_".$updated."`
                     SET `value`=`no`
                ");
            }           
        }

But it makes me sad as it doesn't want to work...

Unknown column 'no' in 'field list'

An error occurred while attempting to execute the following query

UPDATE `sym_entries_data_43` SET `value`=`no`

Thanks for any responses.

Try

                Symphony::Database()->query("
                UPDATE `sym_entries_data_".$updated."`
                 SET `value`='no'
            ");

The grave accent tells MySQL that you want the value column to contain the value of the no column, instead of having the string value of 'no'

Thanks Remie, thought I'd replied to this already. Sorry for the delay was being a noob.

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