Idiorm, a lightweight ORM library, is used on Sae.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.