firlefanz Posted February 14, 2013 Share Posted February 14, 2013 Hello everybody, I am new to this forum so Hello :-) I am an absolute php beginner and a hobby game developer. I need php to send hiscores to my online hiscore list (using mysql) and get that hiscorelist. I had some stuff which was working perfect until I changed my web homepage provider, which also has new mysql und php versions. Right now I cannot insert a score anymore or connect, I always get the error "Connection closed gracefully". To connect to the database I used a file db.inc until now (******* is for my Passwort, dbuser is for my database user): <? $db = mysql_connect("mysql.webhosting68.1blu.de","dbuser ","******** "); mysql_select_db("db172972x1819060",$db); ?> Can anybody pleeeeeease help me? I have own written shareware games online, none of them can send a highscore anymore, please help and thanks a lot :-) And this is how my newscore-php looks like which adds a score: <?php require_once('db.inc.php'); $highscorestring=$_POST["Name"] . $_POST["Info"] . $_POST["Rank"] . $_POST["Score"] . $_POST["Skill"] . $_POST["Level"] . $_POST["Quest"] . $_POST["Vers"] . $_POST["Difficulty"] . "crypter"; if ( md5($highscorestring) == $_POST["Hash"]){ $sql="Select Count(*) from mygame_highscores where ModeID=".$_POST["ModeID"]." and Name='".$_POST["Name"]."'"; $result = mysql_query($sql); $row = mysql_fetch_row($result); if ($row[0] == 0) { $sql = "INSERT INTO mygame_highscores (ModeID,Name,Rank,Info,Score,Skill,Level,Quest,Vers,Difficulty) VALUES ( '".$_POST["ModeID"]."', '".$_POST["Name"]."', '".$_POST["Rank"]."', '".$_POST["Info"]."', ".$_POST["Score"].", ".$_POST["Skill"].", ".$_POST["Level"].", ".$_POST["Quest"].", '".$_POST["Vers"]."', ".$_POST["Difficulty"].")"; } else { $sql = "Update mygame_highscores set Score=".$_POST["Score"].", Skill=".$_POST["Skill"].", Rank='".$_POST["Rank"]."', Level=".$_POST["Level"]." where ModeID=".$_POST["ModeID"]." AND Name='".$_POST["Name"]."' AND Score<".$_POST["Score"]; } $result = mysql_query($sql); $sql="Select Count(*) from mygame_highscores where ModeID=".$_POST["ModeID"]." AND Score>".$_POST["Score"]; $result = mysql_query($sql); $row = mysql_fetch_row($result); echo $row[0]; } else { echo "1000"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/274479-problem-connecting-or-inserting-in-mysql-connection-closed-gracefully/ Share on other sites More sharing options...
jazzman1 Posted February 14, 2013 Share Posted February 14, 2013 Why did you post this topic to the php regex section? Go to the control panel providing you from your web hosting provider and obtain details about your database configuration. Quote Link to comment https://forums.phpfreaks.com/topic/274479-problem-connecting-or-inserting-in-mysql-connection-closed-gracefully/#findComment-1412425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.