-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.php
39 lines (30 loc) · 1.02 KB
/
comment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
session_start();
require("config.php");
?>
<?php
if(isset($_POST['submit']))
{
$default_time = $_SERVER['REQUEST_TIME'];
$customtime = date("Y-m-d H:i:s",$default_time);
echo "<pre>"; print_r($_POST);
echo "<pre>"; print_r($_SESSION);
$ef=mysql_query( "insert INTO comments(userid,articleid,comment,username,date) VALUES (".$_SESSION['userid'].",".$_POST['article_id'].",'".$_POST['comment']."','".$_SESSION['username']."','".$customtime."' ) ") or die(mysql_error() );
}
else
{
echo "Values not submitted successfully";
echo "<a href='author.php'><button type='button'>Go Back</button></a>";
}
//'".$_POST['author']."'
$join= mysql_query("SELECT comments.comment from comments JOIN user ON comments.articleid=user.abc") or die(mysql_error());
if( mysql_num_rows($join)>0 )
{
while( $res=mysql_fetch_array($join) )
{
echo "<pre>";
print_r ($res);
echo "</pre>";
}
}
?>