473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Unexpected absence of expected warning

Hi Group,
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php

function Intelli()
{
echo"Hello P";
}

function Bitz()
{
echo"Hello MySQL";
}

;
$a = 1;
if($a)
$myFunc = 'Intelli';
else
$myFunc ='Bitz';

$myFunc();
print'header';

session_start();
setcookie('userid')
?>

----------------------------------------------------------------
The following is the output i got.
There is no warning

[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

Hello Pheader
-------------------------------------------------------------

can any one explain why i din get the warning.....

Apr 30 '07 #1
2 2047
geevaa wrote:
Hi Group,
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php

function Intelli()
{
echo"Hello P";
}

function Bitz()
{
echo"Hello MySQL";
}

;
$a = 1;
if($a)
$myFunc = 'Intelli';
else
$myFunc ='Bitz';

$myFunc();
print'header';

session_start();
setcookie('userid')
?>

----------------------------------------------------------------
The following is the output i got.
There is no warning

[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

Hello Pheader
-------------------------------------------------------------

can any one explain why i din get the warning.....
Hi,

one possibility could be activated output buffering. Check the setting
of output_buffering in current settings.
Hint <http://de.php.net/manual/en/ref.outcontrol.php>

hth,
Roy
Apr 30 '07 #2
On Apr 30, 8:04 am, geevaa <govivasa...@gmail.comwrote:
Hi Group,
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php

function Intelli()
{
echo"Hello P";

}

function Bitz()
{
echo"Hello MySQL";

}

;
$a = 1;
if($a)
$myFunc = 'Intelli';
else
$myFunc ='Bitz';

$myFunc();
print'header';

session_start();
setcookie('userid')
?>

----------------------------------------------------------------
The following is the output i got.
There is no warning

[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

Hello Pheader
-------------------------------------------------------------

can any one explain why i din get the warning.....
When I run the code I get the warning. Check that you have
display_errors enabled and error_reporting set appropriately in
php.ini.

Apr 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Grzegorz Dostatni | last post by:
Consider the following fragment: >>> for i in ('a','b','c'): .... for i in (1,2,3): .... print i, .... print i, .... 1 2 3 3 1 2 3 3 1 2 3 3 Now. I believe I know what...
3
by: Teddy | last post by:
Hello all According to "Think in C++ Volume2", the code below should run smoothly: #include <iostream> #include <exception> using namespace std; class ex { };
6
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am...
62
by: ashu | last post by:
hi look at this code include <stdio.h> int main(void) { int i,j=2; i=j++ * ++j * j++; printf("%d %d",i,j); return 0;
9
by: Roal Zanazzi | last post by:
Hi everyone, I've accidentally found something in my C++ code that is definitively weird. It is obviously an error in my code, but it is not signalled by Microsoft Visual C++ 2005 compiler, not...
4
by: alacrite | last post by:
#include <iostream> #include <vector> using namespace std; int binarySearch(vector<int>, int, int, int); int main() { vector<intarrInt;
2
by: Dimitri Furman | last post by:
SQL Server 2000 SP4. Running the script below prints 'Unexpected': ----------------------------- DECLARE @String AS varchar(1) SELECT @String = 'z' IF @String LIKE ''
6
by: geevaa | last post by:
Hi Group, The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output. I tried to use that functions at last line but no warning!....
13
by: bintom | last post by:
I ran the following simple code in C++ and got unexpected results: float f = 139.4; cout << f; Output: 139.399994;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.