webclown Posted February 28, 2007 Share Posted February 28, 2007 Hi guys I keep getting error :Cannot modify header information - headers already sent by (output started at C:\wamp\www\Tipping\common.inc:44) in C:\wamp\www\Tipping\common.inc on line 38. But I can't see waht is worng with the code can any one help. code: <?php function connect_db(){ $dbhost = 'localhost'; $dbuser = 'webuser'; $dbpass = 'webpass'; $dbname = 'tipping'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); } function close_con(){ mysql_close(); } function get_cround(){ connect_db(); $sql = ("SELECT * FROM admin"); $query = mysql_query($sql); while ($row = mysql_fetch_array($query)){ $cround = $row['cround']; } return $cround; } function enterTips(){ $uid = "23"; $round = $_REQUEST['round']; $query = "INSERT INTO tips VALUES('','$uid','$round'"; for($i=1;$i<9;$i++){ $game = "r$round"; $game .="g$i"; $g1 = $_POST[$game]; $query .= ",'$g1'"; } $query .=")"; connect_db(); mysql_query($query); header("location:commservman.php?error=exists"); exit; } ?> sory it is a bit long. Quote Link to comment Share on other sites More sharing options...
btherl Posted February 28, 2007 Share Posted February 28, 2007 It's possible you have a space or empty line before your "<?php". I don't see anything in your code that I would expect to generate output. Quote Link to comment Share on other sites More sharing options...
webclown Posted February 28, 2007 Author Share Posted February 28, 2007 Sorry Guy just the another post on this site that fixed the problem. Great site, good help. cheers. Quote Link to comment Share on other sites More sharing options...
webclown Posted February 28, 2007 Author Share Posted February 28, 2007 I have added ob_start() at the start of the script. <?php ob_start(); .... All good. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.