-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsql.php
58 lines (47 loc) · 1.21 KB
/
sql.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
56
57
58
<?php
include'core/init.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');
//$queryselpost= "select * from post where `user_id`=$session_user_id";
//$resultselpost=mysqli_query($con,$queryselpost);
//$countselpost=mysqli_num_rows($resultselpost);
$query= "select * from post where `user_post_id`>$from and `user_post_id`<$to and `user_id`=$session_user_id";
//$query= "select * from post where `user_id`=$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'];
$data=$data.'<blockquote><p>'.$feed.'</p></blockquote>';
}
$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();
?>