| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
Quote |
Quote() |
Never | Work in Progress |
ADODB Compatibility function. See http://phplens.com/adodb/reference.functions.quote.html for more information. Returns a quoted string with all characters that have special meaning for the database escaped. This function is the same as database→getEscaped except that the string returned is surrounded by single quotes.
string Quote ( $text )
| $text | string | is a string to be quoted. |
Example
$database =& JFactory::getDBO(); $text = $database->Quote( "Joomla! is 'Power in Simplicity'!" ); $sql = "SELECT * FROM #__content WHERE introtext=$text"; $database->setQuery( $sql ); if (!$database->query()) { echo $database->stderr(); } echo $database->getQuery();
might produce:
Result
SELECT * FROM jos_content WHERE introtext='Joomla! is \'Power in Simplicity\'!'