What's new

Welcome to xCrud Community - Data Management and extended PHP CRUD

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

use "connection" in xcrud instance?

k439

New member
Joined
Dec 9, 2021
Messages
10
Reaction score
0
Points
1
Location
Texas
I am using
$xcrud = Xcrud::get_instance()
$xcrud->connection(DATABASE_USER,DATABASE_PASSWORD,DATABASE_NAME);

but xcrud is using the default connection data from xcrud_config.php
I thought "connection" was supposed to override the default connection.
 

DaDo

Administrator
Staff member
Joined
Dec 1, 2021
Messages
108
Reaction score
23
Points
18
I am using
$xcrud = Xcrud::get_instance()
$xcrud->connection(DATABASE_USER,DATABASE_PASSWORD,DATABASE_NAME);

but xcrud is using the default connection data from xcrud_config.php
I thought "connection" was supposed to override the default connection.
Hello, you have possibility to set value to xcrud like

PHP:
Xcrud_config::$some_parameter = 'some value';

in your case:
PHP:
//override the default connection parameter for this page only
Xcrud_config::$dbname = 'some value';
Xcrud_config::$dbpass = 'some value';
Xcrud_config::$dbuser = 'some value';
Xcrud_config::$dbhost = 'some value';
Xcrud_config::$dbport = 'some value';

//or create new instance 
     $xcrud_new_instance =  Xcrud::get_instance();

       $xcrud_new_instance->connection('some value'','some value'','some value'','some value'');
 
Top Bottom