I am facing some problem with MySQL database. actually It was fast when I did testing on My localhost..but when I uploaded to public server it is slow. data s are displaying but taking more time than usual. there are 7 table which opens to read for a single page. so what I did is for first table I added username and password. for last table I am closing database using mysql_close($db);
command.
is this the right way to do it?? I haven't much experience in database. I have used simple method for calling data.
$db = mysql_connect("localhost", "username", "password") or die("Could not connect.");
mysql_select_db("database",$db)or die(mysql_error());
$result = mysql_query("SELECT * FROM table WHERE web='$data'")or die(mysql_error());
$row = mysql_fetch_array($result);
$daysA = $row['regtime'];
$days = (strtotime(date("Y-m-d")) - strtotime($row['regtime'])) / (60 * 60 * 24);
if($row > 0 && $days < 7){
$data = $row['data'];
$data1 = $row['data1'];
$data2 = $row['data2'];
$data3 = $row['data3'];
$data4 = $row['data4'];
}else{
//some function to fill database }
then at end of 7th table I added database close mysql_close($db);
Please help