Has any master used Sina Cloud AH novice A

Source: Internet
Author: User
Who used Sina cloud Ah, help Ah, a novice
The database in the Sina platform after the build, how and their own managed code to link up Ah, in PHP with mysql_connect () seemingly not AH
For example, create a file conn.php, the code is as follows

$conn = mysql_connect ("w.rdc.sae.sina.com.cn:3307", "Sae_mysql_user", "Sae_mysql_pass") or Die ("Database link error");
mysql_select_db ("BBS", $conn);
mysql_query ("Set names ' GBK '"); Use GBK Chinese code;
?>

It will appear every time you browse.
sae_warning:mysql_connect () [Function.mysql-connect]: This app isn't authorised in conn.php on line 2

Sae_warning:mysql_connect () [Function.mysql-connect]: in conn.php on line 2
Database link Error

How to do it, alas .....

------Solution--------------------
"Sae_mysql_user", "Sae_mysql_pass"???
Sae_mysql_user, Sae_mysql_pass
------Solution--------------------
Sae_mysql_user, Sae_mysql_pass

This is the user name and password for your database.

It's not for you to fill it up.
------Solution--------------------
Sae_mysql_user, Sae_mysql_pass

These two are the constant of the SAE, you write directly no problem. The problem is.
Mysql_connect ("w.rdc.sae.sina.com.cn:3307"

Also to write ...

$con = mysql_connect (sae_mysql_host_m. ': '). Sae_mysql_port,sae_mysql_user,sae_mysql_pass);
------Solution--------------------
There are two ways to do this.
First, use the variable that comes with the SAE.
Second, use the Saemysql class provided by SAE to operate
------Solution--------------------
Sea Direct query on it can AH


$mysql = new Saemysql ();
$sql = "SQL statement";
$data = $mysql->getdata ($sql);


The sea returns a multidimensional array
$data [xxx][' XXX '];
$mysql->closedb ();
  • 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.