comments.php

by nick on March 8th, 2010
No notes
Syntax: PHP
Show lines - Hide lines - Show in textbox - Download
<?
//Manage requests 
    if(!$_POST['action'])
    {
      header ("Location: comments.html"); 
    }
      else
      {
        $connect = connect(HOST, USER, PASSWORD);
        switch($_POST['action']){
         //Case Updating the code
         case "update":
         $sqlQuery = getComments($connect, 20);
         while($row = mysql_fetch_array($sqlQuery))
         {
           $result .= "<li><img src=\"/images/commentIcon.png\" alt=\"\" />
           <span class=\"commentName\">".$row['name']."&nbsp;</span><span class=\"commentDate\"> &#64;".$row['date']."</span>
           <br /><br /><hr /><br /><span class=\"commentText\"> ".$row['comment']."</span><br /><br /></li>";
         }
         echo $result;
         break;
         //Case Inserting Data
         case "insert":
         echo insertComment($_POST['name'], $_POST['comment']);
         break;
      }
      mysql_close($connect);
    }
 
?>

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS