[PHP] How to Use PHP on Baidu (BAE) and Sina (SAE) Cloud platforms to connect to MySQL and return

Source: Internet
Author: User
Tags mysql functions
The following describes how to use BAE to connect to MySQL. The basic call is the same as the related MySQL functions of PHP: mysql_query-send a MySQL query mysql_fetch_array-get a row from the result set as the associated array or number array, or both mysql_fetch_row-get a row from the result set as the enumerated array mysql_fetch_ass

The following describes how to use BAE to connect to MySQL. The basic call is the same as the related MySQL functions of PHP: mysql_query-send a MySQL query mysql_fetch_array-get a row from the result set as the associated array or number array, or both mysql_fetch_row-get a row from the result set as the enumerated array mysql_fetch_ass

The following describes how to use BAE to connect to MySQL. The basic call is the same as the related MySQL functions of PHP:

Mysql_query-send a MySQL Query

Mysql_fetch_array-get a row from the result set as an associated array, or number array, or both

Mysql_fetch_row-retrieve a row from the result set as an enumerated Array

Mysql_fetch_assoc-get a row from the result set as the associated array

Mysql_result-get result data

Tutorial Manual: Click to View Details

 



The following are the connection methods of SAE, many of which have been encapsulated. You can directly use SQL statements:

 GetData ($ SQL); $ name = strip_tags ($ _ REQUEST ['name']); $ age = intval ($ _ REQUEST ['age']); // INSERT $ SQL = "INSERT INTO 'user' ('name', 'age', 'regtime') VALUES ('". $ mysql-> escape ($ name ). "','". intval ($ age ). "', NOW ()"; $ mysql-> runSql ($ SQL); if ($ mysql-> errno ()! = 0) {die ("Error:". $ mysql-> errmsg () ;}$ mysql-> closeDb () ;?>

When you connect to phpAdmin, if you haven't performed the operation for a long time, the page will be prompted to expire. Press CTRL + F5.

Press F5. Sometimes some content will not be updated, and CTRL + F5 will update all content.

The specific differences are:
F5 usually only refreshes the local cache;
Ctrl + F5: delete the files in the Intenet Temporary Folder and download them from the server again, that is, refresh the page completely.



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.