php - MYSQL get data BETWEEN AND condition OR condition -
i trying fetch data json between 2 id's have userid either get['id']
or user follow get['id']
other table.
my url - http://localhost/aditya/m/login?id=1&&start=6
if(isset($_get['start'])) { $query2 = "select * post (id between '".$_get['start']."' , '".$_get['start']."' + 3) , userid = '".$_get['id']."' or userid in (select userid frndlist followers = '".$_get['id']."') "; }
data coming in between id 6 9 why 5 coming ?? (postid in json id) !!
{ "result":[ { "like":"</a>", "like_no":"0</span>", "time":"th , ", "pro_pic":"members/boykiller654@gmail.com/win_20150115_125206.jpg", "userid":"2", "fname":"aditya", "lname":"raj", "share":"innovation", "title":"tasty", "postid":"5", "postimg":"http://192.168.43.142/aditya/mfoodora/members/boykiller654@gmail.com/download-371493367.jpg", "desc":"hejgfiyrivbgdyvdgvgjdehuidkjvdakllj", "comm_no":"0", "comment":"</a>", "add":"</a>" }, { "like":"</a>", "like_no":"0</span>", "time":"th , ", "pro_pic":"members/boykiller654@gmail.com/win_20150115_125206.jpg", "userid":"2", "fname":"aditya", "lname":"raj", "share":"trick", "title":"tasty", "postid":"6", "postimg":"", "desc":"hejgfiyrivbgdyvdgvgjdehuidkjvdakllj", "comm_no":"0", "comment":"</a>", "add":"</a>" }, { "like":"</a>", "like_no":"1</span>", "time":"mar 24th", "pro_pic":"members/boykiller654@gmail.com/win_20150115_125206.jpg", "userid":"2", "fname":"aditya", "lname":"raj", "share":"recipe", "title":"tasty", "postid":"7", "postimg":"", "desc":"hejgfiyrivbgdyvdgvgjdehuidkjvdakllj", "comm_no":"0", "comment":"</a>", "add":"</a>" }, { "like":"</a>", "like_no":"0</span>", "time":"mar 25th", "pro_pic":"members/aditraj2@gmail.com/win_20150115_140702.jpg", "userid":"1", "fname":"joe", "lname":"harris", "share":"trick", "title":"chicken hyderabadi biryani", "postid":"9", "postimg":"http://192.168.43.142/aditya/mfoodora/members/aditraj2@gmail.com/chocolate-mint-bar-1231354420.jpg", "desc":"so , here goes .. it's hybrid biryani found in india . vey famous , tasty but...read more</a>", "comm_no":"1", "comment":"</a>", "add":"</a>" } ] }
try grouping or
statement putting in parenthesis.
select * post (id between '1' , '500' + 5) , (userid = 'testuserid' or userid in (select user frndlist followers = 'tom') )
Comments
Post a Comment