mistari Posted January 29, 2008 Share Posted January 29, 2008 Here is the work in progress: http://www.mistari.com the id does not display in the url on the add comment page: "http://www.mistari.com/addcomments.php?id=" addcomments.php: <?php include('header.inc'); xxxx $action = strip_tags($_GET["action"]); $id = strip_tags($_GET["id"]); if ($action=="add") { $name = strip_tags($_POST["name"]); $entry = strip_tags($_POST["entry"]); $email = strip_tags($_POST["email"]); // add comments if (empty($name) || empty($entry)) { die ("Error, you cannot submit a blank entry."); } $q = "insert into blog_comments (name, email, date, blog_id, entry) VALUES ('$name','$email',now(),'$id','$entry')"; $result= mysql_query($q) or die ("Could not execute query : $q." . mysql_error()); if ($result) { echo "Comment has been added. Thanks nukka."; echo "<p>Click <a href=\"readcomments.php?id=$id\">here</a> to read.</p>"; } } else { ?> <form action="addcomments.php?action=add&id=<?php echo $blog_id;?>" method="post"> <table width="130" border="0" cellspacing="1" cellpadding="0"> <tr> <td height="23" colspan="2"><b>Add Comment</b></td> </tr> <tr> <td>Name:*</td> <td> <input type="text" name="name" size="30"> </td> </tr> <tr> <td height="25">Email:</td> <td height="25"> <input type="text" name="email" size="30"> </td> </tr> <tr> <td height="25">Comments:*</td> <td height="25"> <textarea name="entry" cols="30" rows="5"></textarea> </td> </tr> <tr><td colspan=2><input type="submit" value="submit"></td></tr> </table></form> <?php } include('footer.inc'); ?> readcomments.php: <?php include('header.inc'); xxxx $id = strip_tags($_GET["id"]); $q = "SELECT * from blog_comments where blog_id='$id' order by date desc "; $result= mysql_query($q) or die ("Could not execute query : $q." . mysql_error()); while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $name=$row["name"]; $email=$row["email"]; $entry=$row["entry"]; $date=$row["date"]; $blog_id = $row["blog_id"]; ?> <table width="80%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <td>Comments for <?php echo "$title"; ?></td> </tr> <tr> <td> <?php echo "$entry"; ?> <p>Posted by <a href="mailto:<?php echo "$email"; ?>"><?php echo "$name"; ?> on <?php echo "$date"; ?>.</p> </td> </tr> </table> <?php } // display write comments HTML here. ?><p align="center"><a href="<?php echo "addcomments.php?id=$blog_id"; ?>">Add Comments</a></p> <?php include('footer.inc'); ?> someone help me? this is driving me nuts! and i know its something really small!! Quote Link to comment Share on other sites More sharing options...
marcus Posted January 29, 2008 Share Posted January 29, 2008 just do <?php echo "addcomments.php?id=".$id.""; ?> Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 where? Quote Link to comment Share on other sites More sharing options...
marcus Posted January 29, 2008 Share Posted January 29, 2008 where your add comments link is. Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 nope it didn't work. no comment appears. Quote Link to comment Share on other sites More sharing options...
marcus Posted January 29, 2008 Share Posted January 29, 2008 0 comments and on addcomments. find this line: <?php echo $blog_id;?> replace: <?php echo $id;?> Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 ok it works for the first comment. then if i was to add a second comment, it puts the id in the url as a different, bigger number. Quote Link to comment Share on other sites More sharing options...
marcus Posted January 29, 2008 Share Posted January 29, 2008 fine for me. Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 i see your comment. maybe if you enter more than one, that's the problem? Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 lol. HAI!!! here's all the database entries. Full Texts id name email date blog_id entry Edit Delete 25 hello 2008-01-28 18:46:13 4 sfdfssfd Edit Delete 24 test2 2008-01-28 18:44:40 23 testing again Edit Delete 23 tester 2008-01-28 18:44:26 4 testing Edit Delete 22 hello 2008-01-28 18:41:37 0 HAI MISTARI. Edit Delete 20 Joe 2008-01-28 18:39:59 0 test Edit Delete 21 joe 2008-01-28 18:40:13 0 test Edit Delete 26 marcus 2008-01-28 18:49:12 23 HOLA. Edit Delete 27 test again 2008-01-28 18:49:40 23 again.. where's it getting these numbers from??? Quote Link to comment Share on other sites More sharing options...
mistari Posted January 29, 2008 Author Share Posted January 29, 2008 bump Quote Link to comment Share on other sites More sharing options...
mistari Posted January 30, 2008 Author Share Posted January 30, 2008 bump** 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.