S A N T A Posted April 27, 2008 Share Posted April 27, 2008 Ok so i am working on a blog and so far everything is working but now i am trying to make an archive of all the categories but when i try to use it it displays the categories Life Work Music Food from a database but when i click them its suppose to display all the entries in that category but it displays this error: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\header.php:11) in C:\xampp\htdocs\viewcat.php on line 15 here is the code <?php require("config.php"); require("header.php"); ?> <div id="main"> <?php if(isset($_GET['id']) == TRUE) { if(is_numeric($id) == FALSE) { $error = 1; } if($error == 1) { header("Location: " . $config_basedir . "/viewcat.php"); } else { $validcat = $_GET['id']; } } else { $validcat = 0; } $db = mysql_connect($dbhost, $dbuser); mysql_select_db($dbdatabase, $db); $sql = "SELECT * FROM categories"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { if($validcat == $row['id']) { echo "<strong>" . $row['cat'] . "</strong><br />"; $entriessql = "SELECT * FROM entries WHERE cat_id = " . $validcat . " ORDER BY dateposted DESC;"; $entriesres = mysql_query($entriessql)or die(mysql_error(). " in $sql"); $numrows_entries = mysql_num_rows($entriesres); echo "<ul>"; if($numrows_entries == 0) { echo "<li>No entries!</li>"; } else { while($entriesrow = mysql_fetch_assoc($entriesres)) { echo "<li>" . date("D jS F Y g.iA", strtotime($entriesrow['dateposted'])) . " - <a href='viewentry.php?id=" . $entriesrow['id'] . "'>" . $entriesrow['subject'] . "</a></li>"; } } echo "</ul>"; } else { echo "<a href='viewcat.php?id=" . $row['id'] . "'>" . $row['cat'] . "</a><br />"; } } require("footer.php"); ?> </div> Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/ Share on other sites More sharing options...
eRott Posted April 27, 2008 Share Posted April 27, 2008 Hey, Can you post your code for header.php please? Take care. Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528538 Share on other sites More sharing options...
S A N T A Posted April 27, 2008 Author Share Posted April 27, 2008 header.php = <?php require("config.php"); $db = mysql_connect($dbhost, $dbuser); mysql_select_db($dbdatabase, $db); ?> <DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo $config_blogname; ?></title> <link rel="stylesheet" href="stylesheet.css" type="text/css" /> </head> <body> <div id="header"> <h1><?php echo $config_blogname; ?></h1> </div> <div id="menu"> <center><a href="index.php">home</a></center> Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528539 Share on other sites More sharing options...
coder_ Posted April 27, 2008 Share Posted April 27, 2008 so i guess you havent read this: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528544 Share on other sites More sharing options...
S A N T A Posted April 27, 2008 Author Share Posted April 27, 2008 i don't get it? sorry I'm a n00b EDIT: NVM i fixed it just now when i click the Life Work Music Food buttons they are suppose to show all the entries in that category but they don't do anything? Help Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528546 Share on other sites More sharing options...
eRott Posted April 27, 2008 Share Posted April 27, 2008 EDIT: Sorry, late response. Didn't see your last post. Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528547 Share on other sites More sharing options...
S A N T A Posted April 27, 2008 Author Share Posted April 27, 2008 Well i already fixed the errors (Did what you said just before you said it ) but now I'm having other problems (See my previous post) lol and im having a bit of trouble understanding as I'm only 12 =] Link to comment https://forums.phpfreaks.com/topic/103187-solved-cannot-modify-header-information/#findComment-528549 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.