I am currently writing a program that uses php scripts to log users in and out of the program. The scripts are called by the program and it returns the source code of the page.
For this paticular bit I just need to have the word 'lost' shown if the database wasn't connected to. This is the code I use
<?
$username = $_GET['username'];
if (!$db=mysql_connect(''localhost','username','password'))
{
die("lost");
}
mysql_select_db("database",$db);
$query = "UPDATE users SET online= 'yes' WHERE username = '".$username."' ";
$result = mysql_query ($query,$db);
?>
My problem is that as well as showing the word 'lost' if theres a problem connecting I also get all the headers of the page:
HTTP/1.1 200 OK
Server: Apache/1.3.29 (Unix)
Transfer-Encoding: chunked
Is there a way for PHP to remove all these and just show 'lost'?