We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19116
    • 7 Posts
    I had the same problem when creating TV.

    Solution that worked for me :
    - Put ’0’ in ’Sort Order’ field (thanks to amirm)
    AND - In database, edit the ’caption’ column of the ’modx_site_tmplvars’ table : set the type varchar(255)

    Good luck.
      • 29646
      • 17 Posts
      Howdy,

      I’m curious whether there is a standard fix for this issue. Looking at the messages above (and not having a real deep knowledge of MySQL), it seems like everyone’s taken a slightly different tack to make their systems work. I just started getting this error in the last week or so, and I’m wondering two things, essentially:

      • What happened?
      • What do I do about it?
      I’d sure appreciate it if someone could point me toward a solid fix. Thanks much!

      -aj

      Update: I tried making a TV and used "sort order=0" as above, and that worked fine. I still get "$rs not set! New template not saved!" when trying to save a new template, though.

      Update 2: I set my MySQL server not run in strict mode as per onno above (using these instructions: http://community.zikula.org/Wiki-DisablingMySQL5StrictMode.htm), and I can once again save new templates, so I guess that’s a win. I’m still curious, though, if anyone can shed some light on what may have happened to cause that error in the first place. Thanks!
        ---
        A.J. Van Beest
        Beest Built Websites, LLC
        (877) 292-3378
        • 4856
        • 55 Posts
        This error is appering when "Sort order:" is not input.
        Always input there any number, include 0 or change file

        manager\processors\save_tmplvars.processor.php:

        before code
        		// Add new TV
        		$sql = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (name, description, caption, type, elements, default_text, display,display_params, rank, locked, category) VALUES('".$name."', '".$description."', '".$caption."', '".$type."', '".$elements."', '".$default_text."', '".$display."', '".$params."', '".$rank."', '".$locked."', ".$categoryid.");";
        		$rs = mysql_query($sql);
        

        (about line 67)

        insert two lines
        		// If rank is empty, set rank 0
        		if ($rank == '') $rank = '0';
        
          • 26195
          • 3 Posts
          I have this problem of not able to save a new chunk.
          I am getting a $rs not set! New Chunk not saved! message.

          I tired adding the following line in save_htmlsnippet.processor.php

          ( if ($rank == ’’) $rank = ’0’; )

          But this didn’t correct the error.

          Could you please help me?
            • 4856
            • 55 Posts
            To saranghills:

            There was about creating TV, not chunk. And changes was in manager\processors\save_tmplvars.processor.php, not in save_htmlsnippet.processor.php. Roll changes back. smiley

            If you have problems with chunk - it’s problem of other family. In TV was no field protection from null input in "Sort Order".

            Which data you input?
            Try create simple chunk, without quotes and special chars.
              • 26195
              • 3 Posts
              Thank you dear friend,

              Since there was no change in the behaviour, I rolled it back anyway. (But thank you, pal!)

              It is not just chunks.
              None of the items in the ’Manage resources’ panel can be duplicated or created.
              All of them returns the same error.

              I tired adding an item directly on one of the tables and it worked. But I had to give an id there manually.
              (And this item is shown in the resources panel, I could edit and save them too.)
              There is some problem with the auto-increment I guess.

              Thanks once again for helping me
                • 4686
                • 1 Posts
                I wish someone had suggested that I go into the sql from the website or ftp and assign id numbers to any new chunk or snippet. The chunks might called html snippets.
                But the other comments helped me figure it out.