|
-
Jul 2nd, 2002, 04:19 AM
#1
Thread Starter
Hyperactive Member
setcookie (I will cut my hair)
In this code:
$Sql = "select * from Member where UserName='$UserName' and Password='$Password'";
$Result = mysql_query($Sql);
while ($Row = mysql_fetch_array($Result))
{
setcookie ("VBZooM","$UserName",time()+604800);
}
--
It give me this error
Warning: Cannot add header information - headers already sent by (output started at C:\apache\htdocs\vbzoom\admin\config.php:27) in C:\apache\htdocs\vbzoom\login.php on line 54
--
How can I solve this error ? and what it's hte cause of this error ?
-
Jul 2nd, 2002, 05:40 AM
#2
Fanatic Member
you cannot assign cookies before any other output, it has the the first thing on the page.
I'm assuming that "config.php" is an include, try putting it before that and anything the might be before it.
-
Jul 2nd, 2002, 06:02 AM
#3
Thread Starter
Hyperactive Member
ammmmm
but I want ot set cookies if username and password is correct
-
Jul 2nd, 2002, 07:42 AM
#4
if that is the first code on your page and the config.php file doesn't have any echo or <html> tags in it then you need to take out the spaces after the ?> in the config file.
if the above is not true then you need to show us the code that you have above that line and the code in config.php
-
Jul 2nd, 2002, 08:37 AM
#5
Thread Starter
Hyperactive Member
Yes
Yes there was one space I take it out, it's work now, thank you scoutt . Now I can fix my hair.
-
Jul 2nd, 2002, 09:18 AM
#6
Fanatic Member
*** is with this hair thing dude ?
-
Jul 2nd, 2002, 09:19 AM
#7
Fanatic Member
I think he was ripping it out over this minor problem. Will PHP ever not count white spaces so we all can sleep better at nights when working with cookies?
-
Jul 2nd, 2002, 09:25 AM
#8
I know, it is pretty stupid.
-
Jul 2nd, 2002, 09:27 AM
#9
Fanatic Member
Originally posted by scoutt
I know, it is pretty stupid.
Which part PHP counting white spaces? or the fact he is pulling his hair out over this problem?
-
Jul 2nd, 2002, 09:31 AM
#10
as soon as I posted that I knew that was going to be the question. well I was talking about php but him pulling his hair out is a little stupid.
-
Jul 2nd, 2002, 11:12 AM
#11
Junior Member
Okay, I usually use sessions.. there a lot easier in my opinion..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|