Yes, the quote method does add quotes around the string (which is why the
method is named "quote"). It also works with arrays, quoting each value in
the array and joining the quoted values with commas.
That means that in your queries, you need to omit the quotes:

$name = 'John';
echo $name; // John (no quotes)
$quotedName = $db->quote($name); // returns 'John' (with quotes)

--
Hector


On Mon, Oct 19, 2009 at 5:31 PM, brgi <[email protected]> wrote:

>
> Have been having this same problem where quote() surrounds the data in my
> table with single quotes. Which I thought was the desired behavior until
> reading this thread. I've got magic quotes off. Not understanding how this
> function *doesn't* surround data with quotes. Am looking at the method in
> the Zend/Db/Adapter/Mysqli.php file and seeing:
>
> <pre>
>  /**
>     * Quote a raw string.
>     *
>     * @param mixed $value Raw string
>     *
>     * @return string           Quoted string
>     */
>    protected function _quote($value)
>    {
>        if (is_int($value) || is_float($value)) {
>            return $value;
>        }
>        $this->_connect();
>        return "'" . $this->_connection->real_escape_string($value) . "'";
>    }
> </pre>
>
> That sure looks like it applies quotes, no?
> --
> View this message in context:
> http://www.nabble.com/quoteOutOf--tp6416052p25967880.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to