Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 8 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 11. API Reference arrow [REVIEW] database->Quote

[REVIEW] database->Quote PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

database->Quote

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.

Syntax

string Quote ( string $text )

$text
is the raw string to be escaped and quoted.

Examples

Example:

function doQuery( $text ) {
  global $database;
 
  $text = $database->Quote( $text );
  $sql = "SELECT * FROM #__content WHERE introtext=$text";
  $database->setQuery( $sql );
  if (!$database->query()) {
    echo $database->stderr();
    return false;
  }
 
  echo $database->getQuery();
 
}
 
doQuery( "Joomla 4.5 is 'Power in Simplicity'!" );

might produce:

SELECT * FROM mos_content WHERE introtext='Joomla 4.5 is \'Power in Simplicity\'!'
 

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )
 
< Prev   Next >