| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
replacePrefix |
replacePrefix() |
Never | Work in Progress |
This function replaces a string identifier $prefix with the string held in the _table_prefix class variable.
void replacePrefix ( $sql, $prefix )
| $sql | string | is a string containing the SQL query. |
| $prefix | string | is a string containing the common table prefix. This parameter is optional and if omitted defaults to '#__'. |
Example
$database =& JFactory::getDBO(); $sql = "SELECT * FROM #__content WHERE introtext=test"; echo $sql . '<br />'; $sql = $database->replacePrefix( $sql ); echo $sql;
might produce:
Result
SELECT * FROM #__content WHERE introtext=test
SELECT * FROM jos_content WHERE introtext=test