cocos2d-x curl+PHP network programming ranking list (1) cocos2d x download Yu Guoli quick cocos2d x

WBOY
Release: 2016-07-29 08:49:20
Original
1325 people have browsed it

In order to try network programming, I read a lot of blogs by great people, so I will record this now so as not to forget it.

Before writing the connection code, we must do a few things first:

1. Build WAMP

2. Create a database

3. Write the PHP code

4. Test

1. Installation of wamp

This is relatively simple. I found an installation package from the Internet and installed it.

2. Create a database

I went online and downloaded Navicat for MySQL, which can visually operate the database and facilitate future operations. (1) Just fill in the IP, user name, and password above; (2) Create a new database user in the connection; (3) Create a new table in the newly created database, and then click Design Table to create what you need Data name and its data type; after completing the above steps of database preparation, the following is the preparation of PHP.

3. Write the PHP file: rank.php

This code is for my flappybrid to make rankings. The code is as follows:

$score_max) //如果有同名就跟之前的数据比较,如果比之前大就更新数据 { $sql="update user set score='$score_' where name='$name_'"; mysql_query($sql); } } else {//同名就插入新数据 $sql="insert into user(name,score) values('$name_','$score_')"; mysql_query($sql);  } $li="select* from user where 1 = 1 order by score desc"; $result=mysql_query($li,$link); for($count=1;($row=mysql_fetch_array($result)) &&($count"; echo $row['score']; if($count
Copy after login
4. Enter the URL http://127.0.0.1/ in the browser rank.php?name=bak&score=7758

The page displaysbak->7758, and you can add different data several times.

The above introduces the cocos2d-x curl+PHP network programming ranking list (1), including the content of Cocos2d-X. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!