S A N T A Posted April 24, 2008 Share Posted April 24, 2008 ok so I'm making a blog from scratch and i am adding the comments function but i get this error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\xampp\htdocs\index.php on line 32 from the code: <?php require("header.php"); $sql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1;"; ?> <div id="main"> <?php $result = mysql_query($sql)or die(mysql_error()); $row = mysql_fetch_assoc($result); echo "<h2><a href='viewentry.php?id=" . $row['id'] . "'>" . $row['subject'] . "</a></h2><br />"; echo "<i>In <a href= viewcat.php?id=" . $row['cat_id'] ."'>" . $row['cat'] . "</a> - Posted on " . date("D jS F Y g.iA", strtotime($row['dateposted'])) . "</i>"; echo "<p>"; echo nl2br($row['body']); echo "</p>"; echo "<p>"; $commsql = "SELECT name FROM comments WHERE blog_id = " . $row['id'] . " ORDER BY dateposted;"; $commresult = mysql_query($commsql); $numrows_comm = mysql_num_rows($commresult); if($numrows_comm == 0) { echo "<p>No comments.</p>"; } else { echo "(<strong>" . $numrows_comm . "</strong>) comments : "; $i = 1; while($comrow = mysql_fetch_assoc($commresult)) { echo "<a href='veiwentry.php?id=" . $row['id'] ."#comment" . $1 "'>" . $commrow['name'] . "</a> "; $i++; } } require("footer.php"); ?> Help is needed Link to comment https://forums.phpfreaks.com/topic/102804-solved-syntax-error-help/ Share on other sites More sharing options...
wildteen88 Posted April 24, 2008 Share Posted April 24, 2008 The problem is here: echo "<a href='veiwentry.php?id=" . $row['id'] ."#comment" . $1 "'>" . $commrow['name'] . "</a> "; I presume $1 is supposed to be $i, corrected code: echo "<a href='veiwentry.php?id=" . $row['id'] ."#comment" . $i . "'>" . $commrow['name'] . "</a> "; Link to comment https://forums.phpfreaks.com/topic/102804-solved-syntax-error-help/#findComment-526576 Share on other sites More sharing options...
S A N T A Posted April 24, 2008 Author Share Posted April 24, 2008 i am so stupid..... thats a bunch Link to comment https://forums.phpfreaks.com/topic/102804-solved-syntax-error-help/#findComment-526577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.