Simple use notes for the "SAE" MySQL Database

Source: Internet
Author: User

Because the SAE PHP does not have file write permission, it uses MySQL to store data. Here are some simple notes to use.

1, some constants

User name: sae_mysql_user Password: sae_mysql_pass Main Library domain name: sae_mysql_host_m from the library domain name: sae_mysql_host_s port: Sae_mysql_port database name: sae_my sql_db

2. The Saemysql class based on the MySQL module provided by SAE:

<?php$mysql = new Saemysql (); $sql = "select * from ' user ' LIMIT"; $data = $mysql->getdata ($sql); $name = Strip_ta GS ($_request[' name ')); $age = Intval ($_request[' age '); $sql = "INSERT into  ' user ' (' name ', ' age ', ' regtime ') VALUE S (' "  . $mysql->escape ($name). "‘ , ‘" . Intval ($age). "', Now ())"; $mysql->runsql ($sql); if ($mysql->errno ()! = 0) {die    ("Error:". $mysql->errmsg ());} $mysql->closedb ();? >

3, can also use the standard Mysql,mysqli and PDO module, with MySQL as an example

<?php//The main library $link=mysql_connect (sae_mysql_host_m. ': '). Sae_mysql_port,sae_mysql_user,sae_mysql_pass); if ($link)
{ mysql_select_db (sae_mysql_db, $link);}? >

Simple use notes for the "SAE" MySQL Database

Related Article

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.