Home > Backend Development > PHP Tutorial > Solve the problem of errors when PHP connects to Sina Cloud and mySQL database

Solve the problem of errors when PHP connects to Sina Cloud and mySQL database

WBOY
Release: 2016-08-08 09:19:52
Original
868 people have browsed it

At the beginning, when I connected to the server, I wrote this.

$link = mysql_connect('w.rdc.sae.sina.com.cn:3307','',''); 
Copy after login
The result is an error: this app is not authorized

It turns out that when connecting to the server, you should connect like this

$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
附:
<?php
// 连主库
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);

// 连从库
// $link=mysql_connect(SAE_MYSQL_HOST_S.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);

if($link)
{
    mysql_select_db(SAE_MYSQL_DB,$link);
}
Copy after login

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the problem solving when PHP connects to Sina Cloud and mySQL database, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template