Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $con = mysql_connect("localhost","inmoti6_myuser","mypassword");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("inmoti6_mysite", $con);
- $article_id = $_GET['id'];
- if( ! is_numeric($article_id) )
- die('invalid article id');
- $query = "SELECT * FROM `comments` WHERE `articleid` =$article_id LIMIT 0 , 30";
- $comments = mysql_query($query);
- echo "<h1>User Comments</h1>";
- while($row = mysql_fetch_array($comments, MYSQL_ASSOC))
- {
- $name = $row['name'];
- $email = $row['email'];
- $website = $row['website'];
- $comment = $row['comment'];
- $timestamp = $row['timestamp'];
- $name = htmlspecialchars($row['name'],ENT_QUOTES);
- $email = htmlspecialchars($row['email'],ENT_QUOTES);
- $website = htmlspecialchars($row['website'],ENT_QUOTES);
- $comment = htmlspecialchars($row['comment'],ENT_QUOTES);
- echo " <div style='margin:30px 0px;'>
- Name: $name<br />
- Email: $email<br />
- Website: $website<br />
- Comment: $comment<br />
- Timestamp: $timestamp
- </div>
- ";
- }
- mysql_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement