-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsqlv1.php
55 lines (44 loc) · 1.25 KB
/
sqlv1.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
error_reporting(0);
class Feeds{
public function query($from,$to){
$session_user_id=$_SESSION['user_id'];
$con= mysqli_connect("localhost","root","","users")or die('error');
$query= "select * from post where `user_post_id`>$from and `user_post_id`<$to and `user_id`=$session_user_id";
$result=mysqli_query($con,$query);
$count=mysqli_num_rows($result);
$data='';
if($count>0)
{
//echo $query;
while($row=mysqli_fetch_array($result))
{
$id=$row['user_post_id'];
$feed=$row['post_content'];
//return $feed;
//$data=$data.'<blockquote><p>'.$feed.'</p></blockquote>';
$data = $data.'<div class="wrap"><div class="post_wrap">'.$feed.'</div><div class="action_wrap"><ul><li><input type=\'submit\' name=\'like\' value=\'Upvote\'><input type=\'submit\' name=\'like\' value=\'Downvote\'></li></ul></div><div class="comment_wrap"></div></div>';
}
$data=$data.'<div class="final" val="'.$id.'"></div>';
return $data;
}
else{
return '0';
}
}
public function main(){
if(isset($_POST['from'])){
$from= $_POST['from'];
$to= $from+4;
$data=$this->query($from,$to);
echo $data;
}
else{
$data=$this->query(0,4);
return $data;
}
}
}
$obj= new Feeds();
$data=$obj->main();
?>