Switch to: V11V10V9V8V7V6V5

valentina_select_db()

Declaration

bool valentina_select_db ( 
               string dbNameOrPath, 
               [resource link_identifier,] 
               [string encription_key,]
               [int data_kind] )

Parameters

Name Description
database_nameThe name of the database that is to be selected.
link_identifierThe connection. If the link identifier is not specified, the last link opened by valentina_connect() is assumed. If by chance no connection is found, an E_WARNING level warning is generated.
string encription_keyEncryption key to be used if the database is encrypted.
int data_kind One of following constants:
VALENTINA_DATAKIND_STRUCTUREONLY
VALENTINA_DATAKIND_STRUCTURE_AND_RECORDS
VALENTINA_DATAKIND_RECORDSONLY.

Description

Sets the current active database on the server that's associated with the specified link identifier. Every subsequent call to valentina_query() will be made on the active database.

In the LOCAL mode this function acts as db.open().

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example 1.

<?php
 
$link = valentina_connect('localhost', 'val_user', 'val_password');
if (!$link) {
   die('Not connected : ' . valentina_error());
}
 
// make foo the current db
$db_selected = valentina_select_db('foo', $link);
if (!$db_selected) {
   die ('Can\'t use foo : ' . valentina_error());
}
?> 

Notes

Note For downward compatibility, the following deprecated alias may be used: valentina_createdb()

See Also