Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 23rd, 2005, 10:45 PM
Registered User
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help finishing project

When a user tries to register on the site this error shows up:

Warning: Cannot modify header information - headers already sent by (output started at /home/ratedate/public_html/burgundyblue/config.php:24) in /home/ratedate/public_html/burgundyblue/adduser.php on line 8

I have included Config.php code and adduser.php code any help would be appreciated.

 $connect_string = 'localhost';
 $connect_username = '******_ratedat';
 $connect_password = '***';
 $connect_db = 'ratedate_*******';
 $site_url = 'http://www.ratemydate.net';
 $admin_mail = 'support@ratemydate.net';
 $site_name = 'DateRate';
 $newmem = 5;
 $topmem = 5;
 $contact_email = 'support@ratemydate.net';
 $var1= 'Rate';
 $var2= 'Pass';
 $year = '2004';
 $var3 = 'Rated';
 $false = '0';
 mysql_connect($connect_string, $connect_username, $connect_password) or die("Connection Failed");
 mysql_select_db($connect_db) or die("Database selection failure");

 $uname= $_POST['username'];
 $pwd= $_POST['password'];
 $flag= 0;
 $check= "SELECT userId,username,password from kissrating_userinfo WHERE username= '" . $uname . "'";
 $query_result= mysql_query($check);
 if($row= mysql_fetch_array($query_result)){
  if($_POST['password'] == $row[2]){
   setcookie("userId", $row[0]) or die("Error ID Cookie could not be set!");
   setcookie("username", $row[1]) or die("Error userName Cookie could not be set!");
   header("location: home.php?opt=2");
  else header("location: index.php?opt=1");
 else header("location: index.php?opt=1");


Need Webhosting?
Old January 24th, 2005, 04:37 PM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

setcookie() function sends headers to the browser. You cannot do this after you have any whitespace or output. So, you must remove any output before the block that contains setcookie().


-Snib - http://www.snibworks.com
Where will you be in 100 years?

Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS scheduled jobs not finishing abob SQL Server DTS 0 July 13th, 2007 07:48 AM
Website project vs Web Application Project... thenoseknows ASP.NET 2.0 Professional 0 January 14th, 2007 09:47 PM
How do i Call one project to another project kau_shuk VS.NET 2002/2003 8 December 5th, 2006 10:02 AM
Add report of one project into another project tejaswibv Crystal Reports 0 July 13th, 2005 04:40 AM
Help with finishing coding on text lenght... Brettvan1 VB.NET 2002/2003 Basics 9 December 3rd, 2004 02:11 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.