Jump to content

Problem connecting (or inserting in MySQL?): Connection closed gracefully


Recommended Posts

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";
}
?>

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.