I am a starter.
I want to know what will happen if we do not close the MySQL connection.
1- Is it possible to open several databases if we do not close them? I mean, can we open several databases at the same time?
2. Does the closing base increase speed?
3. Is it necessary to close the database or not?
Take a look at this code. I do not use "mysql_close ()", so I do not close the database after each request. There are a lot of requests to this PHP page. Maybe 50,000 per minute. I want to know that this code requires a closing database or not?
<?php
include("database/connection.php");
connect("database", "localhost", "root", "", "user");
$received_string = $_GET["variable"];
$array_GPRS_data = explode(",", $received_string);
$array_GPRS_data[9] = substr($array_GPRS_data[9], 1);
$array_GPRS_data[13] = substr($array_GPRS_data[13], 4, 2).substr($array_GPRS_data[13], 2, 2).substr($array_GPRS_data[13], 0, 2);
$query = "INSERT INTO $array_GPRS_data[17](signal_quality, balance, satellite_derived_time, satellite_fix_status, latitude_decimal_degrees,
latitude_hemisphere, longitude_decimal_degrees, longitude_hemisphere, speed, bearing, UTCdate, theChecksum)
VALUES('$array_GPRS_data[0]', '$array_GPRS_data[1]', '$array_GPRS_data[5]', '$array_GPRS_data[6]', '$array_GPRS_data[7]',
'$array_GPRS_data[8]', '$array_GPRS_data[9]', '$array_GPRS_data[10]', '$array_GPRS_data[11]', '$array_GPRS_data[12]', '$array_GPRS_data[13]',
'$array_GPRS_data[16]')";
$result = mysqli_query($query);
if($result)
{
echo("*#01");
}
else
{
echo("Error: 001");
echo (mysqli_error());
}
?>