[function.session-start]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
johnmergene
Forum Newbie
Posts: 16
Joined: Tue Nov 15, 2011 5:51 am

[function.session-start]

Post by johnmergene »

Code: Select all

<html>
<?
session_start();
$emailadd = $_SESSION['Emailadd'];
$con = mysql_connect("fdb3.leadhoster.com","xxxxxxxxxxxxxxx","xxxxxxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("xxxxxxxxxxxxxxxxxx", $con);

$result = mysql_query("SELECT * FROM Account WHERE Emailadd='$emailadd'");
while($row = mysql_fetch_array($result))
  {
          if($row['Md'] == 'None'){
          

	
	
	mysql_query("UPDATE Account SET DJ = '$_POST[DJ]'
	WHERE Emailadd=$emailadd");
	
          }
          else if($row['DJ'] == 'None'){
         
	
	
	
	mysql_query("UPDATE Account SET Md= '$_POST[Md]'
	WHERE Emailadd=$emailadd");
	}
  }

mysql_close($con);
?>
</html>




what is wrong with this code?
this is the error..
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /srv/disk4/xxxxxx0/www/xxxxxxxxxxxx.com/edit.php:2) in /srv/disk4/xxxxxxxx0/www/xxxxxxxxx.xxxxxxxxxxxxxx.com/edit.php on line 3
Last edited by Benjamin on Sun Nov 20, 2011 7:40 am, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: [function.session-start]

Post by twinedev »

You must not output anything before you start the session, not even spacing/blank lines.
johnmergene
Forum Newbie
Posts: 16
Joined: Tue Nov 15, 2011 5:51 am

Re: [function.session-start]

Post by johnmergene »

i place a simple code for riderecting.. but. the values still the same. not updated
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: [function.session-start]

Post by twinedev »

johnmergene wrote:i place a simple code for riderecting..
Have no idea what that means...
johnmergene
Forum Newbie
Posts: 16
Joined: Tue Nov 15, 2011 5:51 am

Re: [function.session-start]

Post by johnmergene »

is my code is correct? the codes after the session?
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: [function.session-start]

Post by twinedev »

The original code you posted, no it is not correct. You are outputting "<html>" and a newline character before starting the session
Post Reply