MYSQL获取数据BETWEEN和条件OR条件

I am trying to fetch data as json between two id's which have userid either Get['id'] or user who follow Get['id'] from other Table.

My URL is - http://localhost/aditya/m/login?id=1&&start=6

if(isset($_GET['start'])) {
$query2 = "SELECT * FROM post WHERE (id BETWEEN '".$_GET['start']."' AND '".$_GET['start']."' + 3) AND userid = '".$_GET['id']."' OR userid IN (SELECT userid FROM frndlist WHERE followers = '".$_GET['id']."') "; }

Data are coming in between id 6 to 9 but why 5 is also coming ?? (postid in json as 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 it goes .. It's a very hybrid biryani especially found in India . Vey famous and tasty but...Read More</a>",
         "comm_no":"1",
         "comment":"</a>",
         "add":"</a>"
      }
   ]
}

Try grouping your OR statement together by putting it in parenthesis.

SELECT * 
FROM post 
WHERE (id BETWEEN '1' AND '500' + 5) AND 
(userid = 'testuserid' OR 
userid IN (SELECT user FROM frndlist WHERE followers = 'tom') )

AND has higher precedence than OR.

WHERE cond1 AND cond2 OR cond3

is interpreted as

WHERE ( cond1 AND cond2 ) OR cond3

Just like 3 * 5 + 4 is interpreted as (3 * 5) + 4

So, as long as the last condition is true, the row will be included.