Idiorm is a lightweight ORM library on Sae. I found a simple and easy-to-use orm library idiorm. I wanted to use it because I thought it was convenient and I was afraid that I could write something that would have security issues. His document is as follows: address in idiorm.readthedocs.orgenlatestindex.html Github: & nbsp; idiorm, a lightweight ORM library, is used on github. comj4miei Sae.
I found a simple and easy-to-use orm library idiorm. I wanted to use it because I thought it was convenient and I was afraid that I could write something that would have security issues.
His documents are as follows: http://idiorm.readthedocs.org/en/latest/index.html
Github address: https://github.com/j4mie/idiorm
The Index. php code is as follows:
Require_once "ORM. php ";
ORM: configure ('MySQL: host = localhost; dbname = mydemotest ');
ORM: configure ('username', 'root ');
ORM: configure ('password', '000000 ');
// Initialization
ORM: configure ('return _ result_sets ', true );
//
$ Account = ORM: for_table ('account')-> create ();
$ Account-> id = 11;
$ Account-> account = 1236;
$ Account-> save ();
They use the following in their documents:
The above code can be run on my local xampp
But there is a problem when it is put on SAEs.
Under my sae, I first created a database with the table name being account.
Then the two files are in the downstream of my Directory (ORM is the idiorm Library)
The code in index. php is:
require_once 'ORM.php';
ORM::configure('mysql:host=w.rdc.sae.sina.com.cn:3307;dbname=SAE_MYSQL_DB');
ORM::configure('username', 'SAE_MYSQL_USER');
ORM::configure('password', 'SAE_MYSQL_PASS');
$account = ORM::for_table('account')->create();
$account->id = 11;
$account->account = 1236;
$account->save();
?>
Then the following problems occur:
Therefore, I would like to ask my predecessors, who have been Baidu for a long time. my knowledge is limited.
Thank you.
------ Solution ----------------------
SAE_MYSQL_XXXX is a constant!
ORM::configure('mysql:host=w.rdc.sae.sina.com.cn:3307;dbname=' . SAE_MYSQL_DB);
ORM::configure('username', SAE_MYSQL_USER);
ORM::configure('password', SAE_MYSQL_PASS);
In addition, the host name and port name also apply the constants SAE_MYSQL_HOST_M and SAE_MYSQL_PORT it provides.