Can't connect to MySQL server on 'localhost' (10048)
Hello,
Could someone help me with the following problem:
I have an application running in PHP & MySQL, and it works great but after a while I get the error 'Can't connect to MySQL server on 'localhost' (10048). I understand that the connection is lost, but everytime this is only for a short moment. After a while I press F5 and the 'website' continues. It is running on a local development environment (PHPdev and other computer Wamp).
Is it a common problem? Is it a sort of time-out, caused by something I don't know?
The error occurs most when I post a form, which inserts a row to a table in my database, but I don't understand why .... The part below is the post-part of my script..
$datum=$_POST['datum'];
$leverancier_id=$_POST['leverancier'];
$inkooporder_id=$_POST['inkooporder'];
$dagnummer=$_POST['dagnummer'];
$maandnummer=$_POST['maandnummer'];
$jaarnummer=$_POST['jaarnummer'];
$datum='' . $jaarnummer . '-' . $maandnummer . '-' . $dagnummer . '';
$kenteken=$_POST['kenteken'];
$chauffeur=$_POST['chauffeur'];
$mysql_id=mysql_connect("$dbhost","$dbuser","$dbpass"); //Coming from an include at the top of the page
$sql="INSERT INTO opslag VALUES ('', '$partij', '$kistnr', '$datum', '', '$celnr', '$bnnr', '$rijnr', '$laagnr','')";
mysql_db_query("$db","$sql",$mysql_id) or die ("lukt niet");
mysql_close($mysql_id);
echo '<script>location.href="index.php?sub=13&celnr='.$celnr.'"</script>';
exit;