gaugeboson Posted December 3, 2007 Share Posted December 3, 2007 [pre] require("config.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; } $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); $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");[/pre] This gives me the output: require("config.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; } $sql = "SELECT * FROM categories"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { if($validcat == $row['id']) { echo "" . $row['cat'] . " "; $entriessql = "SELECT * FROM entries WHERE cat_id = " . $validcat . " ORDER BY dateposted DESC;"; $entriesres = mysql_query($entriessql); $numrows_entries = mysql_num_rows($entriesres); echo " "; if($numrows_entries == 0) { echo " No Entries!"; } else { while($entriesrow = mysql_fetch_assoc($entriesres)) { echo " " . date("D js F Y g.iA", strtotime($entriesrow ['dateposted'])) . " - <a href='viewentry.php?id=" . $entriesrow['id'] . "'>" . $entriesrow['subject'] . ""; } } echo " " } else { echo "<a href='viewcat.php?id=" . $row['id'] . "'>" . $row['cat'] . " "; } } require("footer.php"); Quote Link to comment Share on other sites More sharing options...
peranha Posted December 3, 2007 Share Posted December 3, 2007 Do you have PHP installed and integrated with your web server? Quote Link to comment Share on other sites More sharing options...
scarlson Posted December 3, 2007 Share Posted December 3, 2007 Also I don't see: <?php ?> You need the above tags wrapped around your code. Quote Link to comment Share on other sites More sharing options...
gaugeboson Posted December 3, 2007 Author Share Posted December 3, 2007 I inserted the tags and now see: Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\viewcat.php on line 5 Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted December 3, 2007 Share Posted December 3, 2007 change your line 5 to this if(is_numeric($id) == FALSE) { Quote Link to comment Share on other sites More sharing options...
gaugeboson Posted December 3, 2007 Author Share Posted December 3, 2007 That already is my line 5! Quote Link to comment Share on other sites More sharing options...
peranha Posted December 3, 2007 Share Posted December 3, 2007 You are missing the ) after FALSE on the post. Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted December 3, 2007 Share Posted December 3, 2007 That already is my line 5! no.. its not.. do what i said Quote Link to comment Share on other sites More sharing options...
gaugeboson Posted December 3, 2007 Author Share Posted December 3, 2007 Ah, so it is! That then creates: Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\viewcat.php on line 44 ['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"); ?> Quote Link to comment Share on other sites More sharing options...
jcd Posted December 3, 2007 Share Posted December 3, 2007 Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\viewcat.php on line 44 To be fair, that's a very clear error message. Have you tried scanning around line 44 for a missing ";" which it says it's expecting? Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted December 3, 2007 Share Posted December 3, 2007 you echo statement.. echo "</ul>" is missing semicolon Quote Link to comment Share on other sites More sharing options...
slpctrl Posted December 3, 2007 Share Posted December 3, 2007 I think your time would be better spent learning how to read errors. How can someone code like that and forget to add the <? ?> tags, and not know how to read errors? ??? 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.