pph Posted July 1, 2007 Share Posted July 1, 2007 i got the error message Warning: Cannot modify header information - headers already sent by (output started at /home/eruhuna/public_html/db.php:42) in /home/eruhuna/public_html/Editpartner.php on line 22 line number 22 php code is if($password!=$_SESSION['sessionpass']) { header("Location:index.htm"); }else its works my computer(with apache web server and php 5). when i publish the web site its not working. thanks Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 1, 2007 Share Posted July 1, 2007 This occurs when you are outputting data and then try to change the headers. Check your script from the beginning to line 22 for any output, including whitespace. It may be you send a whitespace character before you open your php tags. Also check any includes. Quote Link to comment Share on other sites More sharing options...
pph Posted July 1, 2007 Author Share Posted July 1, 2007 my code is this <?php session_start(); include("db.php"); $username=$_REQUEST['username']; $sql="select * from penfriends where uname='$username'"; $results=mysql_query($sql); while($row=mysql_fetch_array($results)) { $firstname=$row['fname']; $lastname=$row['lname']; $password=$row['pword']; $dataofbirth=$row['dob']; $gender=$row['gender']; $icq=$row['icq']; $aim=$row['aim']; $city=$row['city']; $country=$row['country']; $hobby=$row['hobby']; $description=$row['des']; } if($password!=$_SESSION['sessionpass']) { header("Location:index.htm"); <---------------------Line 22 }else { how to modify the code thx Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 1, 2007 Share Posted July 1, 2007 Check db.php for any output too. Quote Link to comment Share on other sites More sharing options...
pph Posted July 1, 2007 Author Share Posted July 1, 2007 db.php code is <?php $dbhost = 'localhost'; $dbuser = 'eru'; $dbpass = '11111'; $dbname = 'erw'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname)or die('Cannot select database'); ?> i can't see any problem.please help me thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.