Hi,
Try using the output buffering functions:
PHP Code:
<?php
ob_start();
// connect to the mysql server
$conn = @mysql_connect("localhost","user","psswd")
or die ("Could not connect to mysql table");
// select the database
$rs=@mysql_select_db("database",$conn)
or die ("Could not select database");
//create query
$sql="select * from tblUsers where username='$username' and password='$password'";
$rs=mysql_query($sql,$conn) or die(mysql_error());
if($rs && mysql_num_rows($rs))
{
echo "hello, ";
echo "$username";
header('Refresh: 3; URL="main.php"');
}
else
{
echo "Combination Username/Password is incorrect. Re-enter!";
}
ob_end_flush();
?>
I'm assuming that the opening tag is positioned at the top of the file.
Bookmarks