Jump to content

header problem


pph

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.