PHP Classes

xcrud

Recommend this page to a friend!

      Xmodule  >  All threads  >  xcrud  >  (Un) Subscribe thread alerts  
Subject:xcrud
Summary:xcrud default storage
Messages:3
Author:Marco B
Date:2016-11-01 16:42:08
 

  1. xcrud   Reply   Report abuse  
Picture of Marco B Marco B - 2016-11-01 16:42:08
By default XCRUD stores the data in files in the $storage_id location.
How can I change that so XCRUD by default creates/updates tables via mysqli.

config is already there:

//database configuration
'database'=>array(
'hostname'=>'localhost:3306',
'username'=>'root',
'password'=>'',
'database'=>'xmodule',
'driver'=>'mysqli',
'load'=>TRUE
),

'storage_id'=>'xmodule_storage',

Thanks

  2. Re: xcrud   Reply   Report abuse  
Picture of Mihajlo Siljanoski Mihajlo Siljanoski - 2016-11-01 16:49:42 - In reply to message 1 from Marco B
Hi Marko,

New version with this feature (mySql) is planed to be ready on 10.11.2016. (V.2.9)

  3. Re: xcrud   Reply   Report abuse  
Picture of Mihajlo Siljanoski Mihajlo Siljanoski - 2016-11-01 16:58:33 - In reply to message 1 from Marco B
Also, you can do this by your own way using database module.

ex.
//change
$inserted_data = $storage->insert(
'user', [
'type' => trim(addslashes(strip_tags($_POST['type']))),
'username' => trim(addslashes(strip_tags($_POST['username']))),
'password' => md5($_POST['password'])

]
);

//with
$inserted_data = $db->insert(
'user', [
'type' => trim(addslashes(strip_tags($_POST['type']))),
'username' => trim(addslashes(strip_tags($_POST['username']))),
'password' => md5($_POST['password'])

]
);

Methods for "storage" module and "database" module are very similar.

Documentation link for database module:
xmodule.eco.mk/module/database