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
https://forums.phpfreaks.com/topic/57942-header-problem/
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
https://forums.phpfreaks.com/topic/57942-header-problem/#findComment-287127
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
https://forums.phpfreaks.com/topic/57942-header-problem/#findComment-287137
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.