We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24719
    • 194 Posts
    Just wondering - does xPDO automatically escape data before performing a database operation? I can see the quote function that calls mysql_real_escape_string(), but just want to make sure it is called before an INSERT/UPDATE and that I don’t have to do it myself.

    I’m having trouble inserting data with single quotes when I run the data through $modx->db->escape() myself, but it works fine if I don’t.

    Thanks...
      • 22303 MODX Staff
      • 10,725 Posts
      Yes, PDO takes care of that automatically, as long as you are using prepared statements. Otherwise, use the quote() function from PDO if you want to include raw PHP values. All INSERTs and UPDATEs generated from working with objects in xPDO are automatically handled as well.
        • 24719
        • 194 Posts
        too easy. thanks opengeek.

        i’m getting to grips with xpdo now. it is going to save me a whole lot of time i reckon (would be good if i was using the new core though smiley)
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          ...I just a had a soothing warm feeling come over me... smiley
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Quote from: pixelchutes at Feb 16, 2007, 06:19 PM

            ...I just a had a soothing warm feeling come over me... smiley
            Ah, yes. My youngest son had the same problem until he was 10 or 11; it turned out he was allergic to corn. Took him off corn (and anything with any corn in it, such as cornstarch in the baking powder or corn syrup as a sweetener) and his bed stayed dry! wink
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 25663 MODX Staff
              • 12,272 Posts
              LOL ... what an unexpected setup!
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                embarrassed Sorry... couldn’t resist embarrassed
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 23491 ☆ A M B ☆
                  • 1,056 Posts
                  Quote from: sottwell at Feb 17, 2007, 04:51 PM

                  embarrassed Sorry... couldn’t resist embarrassed

                  You nailed head-on! These new MODx additions all over the place are great for the kidneys! wink
                    Mike Reid - www.pixelchutes.com
                    MODx Ambassador / Contributor
                    [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                    ________________________________
                    Where every pixel matters.