Jump to content

Quotes in MySQL

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
When I try to insert quotes into mysql I get an error and the PHP code I use will not insert quotes. How do I insert quotes into mysql from php?????

#2
RobSoftware

RobSoftware

    Programmer

  • Members
  • PipPipPipPip
  • 143 posts
You have to escape quotes with a \

There is a function in PHP that does this for you. Search php.net for it.

#3
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
dirkFirst: Becuase quotes are operators(string) in php, using them inside of quotes isnt possible. To have php ignore a special character, use \.
so:
echo """;
^^Will give you an error, but
echo "\"";
^^will work, becuase its told to ignore the "special" in special character and just print it.