Home >Backend Development >PHP Tutorial >Access server database through php file in cocos2dx (2)
通过 Last shared how to access your PHP file by writing statements in Cocos2DX to achieve the purpose of the final access to your WAMP server. So this time I will explain how to write your own php file.先 Of course, this requires you to first understand the basic grammar of PHP and the basic operation of the database in order to better realize whether your operation is correct.
l$ mysql_username="root";
$mysql_password="";
$dbname="game";
$USERID=$_GET['username'];
$PASSWORD=$_GET['password'];
$open=fopen("test.xml","w");
if(empty($USERID))
{
fwrite($open,"000");
echo "user is empty" ;
}
else if(empty($PASSWORD))
{
fwrite($open,"001");
echo "password is empty";
}
else
{
$con=mysql_connect($mysql_server,$mysql_username,$mysql_password) ordie("Cannot connect to database");
mysql_select_db($dbname,$con);
$result=mysql_query("select * from newsuser where uname=' $USERID'and upass='$PASSWORD'");
if($row=mysql_fetch_array($result))
{
$hscore=$row['highestScore'];
fwrite($open," 11");
else