Question : How can I avoid this error?

When I executing this code, I am getting this error, Cannot send session cookie - headers already sent by...
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Program Files\xampp\htdocs\projects\test\includes\common.php:145) in D:\Program Files\xampp\htdocs\projects\test\index.php on line 28

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Program Files\xampp\htdocs\projects\test\includes\common.php:145) in D:\Program Files\xampp\htdocs\projects\test\index.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at D:\Program Files\xampp\htdocs\projects\test\includes\common.php:145) in D:\Program Files\xampp\htdocs\projects\test\index.php on line 40
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
<?php

require_once('includes/common.php');

if($_POST['hiden']=="1") {



$uname=$_POST['uname'];

$pword=$_POST['pword'];

if($uname!="" && $pword!="") {

$qry="select * from tn_users where username='$uname' and password='$pword'";



$selectQry=SelectQry($qry);

$userid=$selectQry[0]["userid"];


if($userid!="") {

ob_start();

session_start();

$_SESSION["tnvname"] =$uname;

$_SESSION["tnvid"] =$userid;



$role=$selectQry[0]["role"];

$usertyp=$selectQry[0]["user_typ"];

header("Location:home.php");
}

}

}

?>

Answer : How can I avoid this error?

Have a look at the following:

http://www.mvps.org/access/queries/qry0013.htm

Gary
Random Solutions  
 
programming4us programming4us