I have few import statements in my index.php file. The website is bit slow so I trying to debug it. When I first load the page firebug shows that it’s loading the import statements twice. The second ‘copy’ so to say is still loading(it has the dynamic indicator that it’s loading). I am using Net in firebug to see the results.
In chrome however it only shows once. I have the latest stable version 1.7.3 and I am using firefox 5.
Index.php has two include_once statement. First includes file has the database connections and few import statements. Second one has the header(Simple HTML statements – nothing fancy).
It is a firebug issue or something on my end?
Index.php
<htmL>
<head>
</head>
<body>
<?php
include_once('db_con.php');
include_once('header.php');
?>
<div id="displayAjax"></div>
</body>
</html>
db_con.php
<?php
$host="host";
$username="user";
$password="pass";
$database="dbname";
$table1="table1";
$table2="table2";
$table2="table3";
$con = mysql_connect("$host", "$username", "$password")or die("cannot connect");
$select_db = mysql_select_db("$database")or die("cannot select DB");
ini_set('max_execution_time', 300);
session_start();
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="import/file.css" />
<script type="text/javascript" src="import/jquery.js"></script>
<script type="text/javascript" src="import/ajax.js"></script>
</head>
</html>
header.php
<?php
include_once('db_con.php');
?>
<html>
<head>
</head>
<body>
<div>
<p>Title</p>
Search for:
<input type="textbox" size="27" id="id" class="class" />
<input type="button" value="Search" onclick="searchFunction()" />
</div>
</body>
</html>
So I created a new file new.html. Only HTML syntax, no PHP or JS.
<html>
<head>
<title>Title</title>
</head>
<body>
<p>Something</p>
</body>
</html>
I went to the link directly no includes or imports. This one still loads twice. First one is loaded and it displays ‘Something’ second one is still loading with dynamic indicator.
After all your includes are resolved, you have two full HTML documents. What the browser decides to do with the resulting invalid document is up to the browser.
Take that HTML out of
db_con.php; it has nothing to do with database connections.