| | |
session_start(): Cannot send session cookie - headers already sent by
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2006
Posts: 10
Reputation:
Solved Threads: 1
hi
thrr is no one who can help me this is the prog which when i run faces problem of session.
session_start(): Cannot send session cookie - headers already sent
pls plssssssssss help me to solve the problem below is the code
any one this is simple prog but i can't run
if i can't run thn my boss will kick me out of the office.
so pls hlp me.
[php]<?session_start();?>
<?php
include"db_config.php";
$connect = mysql_connect("$db_host", "$db_user", "$db_password");
mysql_select_db("$db_name", $connect) or die(mysql_error());
$f_name= $_POST['fname'];
$l_name= $_POST['lname'];
$pass= $_POST['password'];
$query = "SELECT * from helpagent WHERE first='$f_name' and last='$l_name' and password='$pass' ";
$result = mysql_query($query);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$id = mysql_result($result, $i, "agentid");
$fname = mysql_result($result, $i, "first");
$lname = mysql_result($result, $i, "last");
$pas = mysql_result($result, $i, "password");
if (("$f_name" == "$fname") and ("$l_name" == "$lname") and ("$pass" == "$pas"))
{
$_SESSION['sfname'] = $fname;
$_SESSION['slname'] = $lname;
$_SESSION['sid'] = $id;
echo("<script>document.location.href='user_page.php';</script>");
exit;
}//if loop
}//for loop
?>[/php]
thrr is no one who can help me this is the prog which when i run faces problem of session.
session_start(): Cannot send session cookie - headers already sent
pls plssssssssss help me to solve the problem below is the code
any one this is simple prog but i can't run
if i can't run thn my boss will kick me out of the office.
so pls hlp me.
[php]<?session_start();?>
<?php
include"db_config.php";
$connect = mysql_connect("$db_host", "$db_user", "$db_password");
mysql_select_db("$db_name", $connect) or die(mysql_error());
$f_name= $_POST['fname'];
$l_name= $_POST['lname'];
$pass= $_POST['password'];
$query = "SELECT * from helpagent WHERE first='$f_name' and last='$l_name' and password='$pass' ";
$result = mysql_query($query);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$id = mysql_result($result, $i, "agentid");
$fname = mysql_result($result, $i, "first");
$lname = mysql_result($result, $i, "last");
$pas = mysql_result($result, $i, "password");
if (("$f_name" == "$fname") and ("$l_name" == "$lname") and ("$pass" == "$pas"))
{
$_SESSION['sfname'] = $fname;
$_SESSION['slname'] = $lname;
$_SESSION['sid'] = $id;
echo("<script>document.location.href='user_page.php';</script>");
exit;
}//if loop
}//for loop
?>[/php]
Last edited by cscgal; Jun 30th, 2006 at 7:42 pm.
•
•
Join Date: Jul 2004
Posts: 494
Reputation:
Solved Threads: 21
I suggest you read the other threads you started, as well as the manual. There are also some very good how-tos out there to teach you how to properly do what you want to.
www.uncreativelabs.net
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Check the manual... if that script is included check that the file that it is actually including it doesn't have any print or echo. session_start() should be at the very beginning of the code.
Also change this:
[php]
<?session_start();?>
<?php
include"db_config.php";
[/php]
to this
[php]
<?php
session_start();
include"db_config.php";
[/php]
There is no need to break the PHP tags there... and use <?php also instead of <? it will make the script work in other servers. Or maybe your server doesn;t support short php tags.
Also change this:
[php]
<?session_start();?>
<?php
include"db_config.php";
[/php]
to this
[php]
<?php
session_start();
include"db_config.php";
[/php]
There is no need to break the PHP tags there... and use <?php also instead of <? it will make the script work in other servers. Or maybe your server doesn;t support short php tags.
•
•
Join Date: Feb 2006
Posts: 32
Reputation:
Solved Threads: 1
I'm assuming that your including this file into another file, and in that other file you have already echoed something when this file is included.
Otherwise I cannot see what is wrong, as suggested the manual always helps.
Otherwise I cannot see what is wrong, as suggested the manual always helps.
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
-1
#5 27 Days Ago
Be sure that your SafeMode CLOSED. Ask your hosting company t switch it to CLOSED. The problem will be solved
•
•
•
•
hi
thrr is no one who can help me this is the prog which when i run faces problem of session.
session_start(): Cannot send session cookie - headers already sent
pls plssssssssss help me to solve the problem below is the code
any one this is simple prog but i can't run
if i can't run thn my boss will kick me out of the office.
so pls hlp me.
[php]<?session_start();?>
<?php
include"db_config.php";
$connect = mysql_connect("$db_host", "$db_user", "$db_password");
mysql_select_db("$db_name", $connect) or die(mysql_error());
$f_name= $_POST['fname'];
$l_name= $_POST['lname'];
$pass= $_POST['password'];
$query = "SELECT * from helpagent WHERE first='$f_name' and last='$l_name' and password='$pass' ";
$result = mysql_query($query);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$id = mysql_result($result, $i, "agentid");
$fname = mysql_result($result, $i, "first");
$lname = mysql_result($result, $i, "last");
$pas = mysql_result($result, $i, "password");
if (("$f_name" == "$fname") and ("$l_name" == "$lname") and ("$pass" == "$pas"))
{
$_SESSION['sfname'] = $fname;
$_SESSION['slname'] = $lname;
$_SESSION['sid'] = $id;
echo("<script>document.location.href='user_page.php';</script>");
exit;
}//if loop
}//for loop
?>[/php]
•
•
Join Date: Oct 2009
Posts: 15
Reputation:
Solved Threads: 3
0
#6 27 Days Ago
PHP Syntax (Toggle Plain Text)
<?php session_start(); ob_start(); include"db_config.php"; $connect = mysql_connect("$db_host", "$db_user", "$db_password"); mysql_select_db("$db_name", $connect) or die(mysql_error()); $f_name= $_POST['fname']; $l_name= $_POST['lname']; $pass= $_POST['password']; $query = "SELECT * from helpagent WHERE first='$f_name' and last='$l_name' and password='$pass' "; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $id = mysql_result($result, $i, "agentid"); $fname = mysql_result($result, $i, "first"); $lname = mysql_result($result, $i, "last"); $pas = mysql_result($result, $i, "password"); if (("$f_name" == "$fname") and ("$l_name" == "$lname") and ("$pass" == "$pas")) { $_SESSION['sfname'] = $fname; $_SESSION['slname'] = $lname; $_SESSION['sid'] = $id; echo("<script>document.location.href='user_page.php';</script>"); exit; }//if loop }//for loop ?>
![]() |
Similar Threads
- Warning: session_start(): Cannot send session cache limiter - headers already sent (PHP)
- session variable error (PHP)
- help with oscommerce (eCommerce)
- Warning: session_start(): (PHP)
- Need Help Correcting These errors (PHP)
Other Threads in the PHP Forum
- Previous Thread: session message printing problem
- Next Thread: Help! echo herf variable, automatically link to the corresponding pages
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube





