PHP Classes

File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_comment.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_comment.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_comment.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 3 months ago
Size: 755 bytes


Class file image Download

$ID = intval($_REQUEST["ID"]);
/* look up the blog posting, make sure it's real */
$query = "SELECT title FROM blog_entries WHERE ID = $ID";
$result = mysql_query($query, $connection) or die(mysql_error());
if (
mysql_num_rows($result) != 1) {
header("Location: blog_index.php");

$name = mysql_escape_string(strip_tags($_REQUEST["name"]));
$comment = mysql_escape_string(strip_tags($_REQUEST["comment"]));
$comment = nl2br($comment);

if (!empty(
$name) && !empty($comment)) {
$query = "INSERT INTO blog_comments
          (ID, comment, name)
           VALUES (
$ID, '$comment', '$name')";
mysql_query($query, $connection) or die(mysql_error());

header("Location: blog_display.php?ID=$ID");

For more information send a message to info at phpclasses dot org.