I'm using PHP and MySQL together.
I have several pages where the users can do different things with a certain MySQL database. In order to save some space I created an include file with a function that connects to the database.
<?
function db_conn()
{
mysql_connect("myhost","myuser","mypass") ;
mysql_select_db("mydb") ;
}
?>
On the target page (almost on each page) I have the following code to call this function:
<?
session_start() ;
require("includefile") ;
...
db_conn() ;
$query=...
...
?>
The code works but after accessing the second or third page I get the following error message on the screen:
Warning: Cannot send session cache limiter - headers already sent (output started at /home/davida/public_html/dolg_mod.php:7) in /home/davida/public_html/dolg_mod.php on line 8
How can I avoid this?
Any help is appreciated.
Regards, Akos