Difference between revisions of "JDatabaseMySQL/select"
From Joomla! Documentation
< API15:JDatabaseMySQL
(New page: ===Description===
Select a database for use
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>...) |
m (preparing for archive only) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 56: | Line 56: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=select | category=select | ||
category=JDatabaseMySQL | category=JDatabaseMySQL | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Latest revision as of 19:28, 24 March 2017
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Select a database for use
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
select($database)
Parameter Name | Default Value | Description |
---|---|---|
$database | $database |
Returns[edit]
boolean True if the database has been successfully selected
Defined in[edit]
libraries/joomla/database/database/mysql.php
Importing[edit]
jimport( 'joomla.database.database.mysql' );
Source Body[edit]
function select($database)
{
if ( ! $database )
{
return false;
}
if ( !mysql_select_db( $database, $this->_resource )) {
$this->_errorNum = 3;
$this->_errorMsg = 'Could not connect to database';
return false;
}
// if running mysql 5, set sql-mode to mysql40 - thereby circumventing strict mode problems
if ( strpos( $this->getVersion(), '5' ) === 0 ) {
$this->setQuery( "SET sql_mode = 'MYSQL40'" );
$this->query();
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]