1395/3/22، 06:05 عصر
سلام . من طبق آموزش های همین سایت پیش رفتم ولی نتونستم امتیاز هارو اپدیت کنم . نمیدونم مشکل کجای کاره . تو بازی وارد نکردم فعلا تو همون هاست درگیر هستم .
اسم رو با یک امتیازی ثبت میکنم یعنی مشکلی در ثبت امتیاز و دریافتش ندارم ولی وقتی میخوام همونو اپدیت کنم مینویسه :
There was a problem saving your score. Please try again later.
اینم کد پی اچ پی برای اپدیت . نمیدونم مشکل از کجاست .
اسم رو با یک امتیازی ثبت میکنم یعنی مشکلی در ثبت امتیاز و دریافتش ندارم ولی وقتی میخوام همونو اپدیت کنم مینویسه :
There was a problem saving your score. Please try again later.
اینم کد پی اچ پی برای اپدیت . نمیدونم مشکل از کجاست .
کد:
<?php
$db = "************";//Your database name
$dbu = "*************";//Your database username
$dbp = "************";//Your database users password
$host = "***********";//MySQL server - usually localhost
$dblink = mysql_connect($host,$dbu,$dbp);
$seldb = mysql_select_db($db);
If(isset($_GET['name']) && isset($_GET['score'])){
//Lightly sanitize the GETs To prevent SQL injections and possible XSS attacks
$name = strip_tags(mysql_real_escape_string($_GET['name']));
$score = strip_tags(mysql_real_escape_string($_GET['score']));
$sql = $sql = mysql_query("UPDATE Game_scores SET score='$score' WHERE name='$name'");
If($sql){
//The query returned TRUE - now do whatever you like here.
echo 'Your score was saved. Congrats!';
}Else{
//The query returned FALSE - you might want To put some sort of error reporting here. Even logging the error To a text file is fine.
echo 'There was a problem saving your score. Please try again later.';
}
}Else{
echo 'Your name or score wasnt passed in the request. Make sure you add ?name=NAME_HERE&score=1337 To the tags.';
}
mysql_close($dblink);//Close off the MySQL connection To save resources.
?>