The following is the SQL for registered users (Which works fine; and it orders by weight):
SELECT b . * FROM tbl_newblocks b, tbl_block_module_link m WHERE m.block_id = b.bid AND b.isactive =1 AND b.visible =1 AND m.module_id IN ( 0 , -1 ) AND b.bid IN ( 218, 204, 203, 202, 201, 191, 192, 188, 187, 186, 184, 185, 178, 170, 169, 168, 167, 166, 171, 172, 173, 165, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 137, 138, 139, 136, 116, 153, 90, 89, 88, 91, 92, 67, 64, 63, 62, 61, 60, 59, 56, 209, 160, 159, 158, 157, 51, 50, 49, 48, 46, 45, 233, 152, 44, 43, 42, 40, 39, 215, 214, 213, 212, 211, 22, 21, 20, 19, 18, 17, 234, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 232, 224, 223, 219, 210, 220, 200, 194, 193, 196, 198, 156, 155, 205, 154, 104, 103, 57, 58, 189, 231, 230, 229, 228, 226, 225, 195, 199, 239 ) ORDER BY b.weight, b.bid LIMIT 0 , 30
The following SQL is for anon users (this does not work, and order by bid but not weight for some reason!):
SELECT b.* FROM tbl_newblocks b, tbl_block_module_link m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id IN (0,-1) AND b.bid IN (204,203,202,201,191,192,184,185,234,172,141,140,137,138,139,136,116,153,90,89,88,91,92,67,64,56,160,159,158,157,51,50,49,48,46,45,233,230,229,228,226,208,195,190,183,39,215,214,213,212,211,22,12,11,10,9,8,7,6,5,4,3,2,1,232,224,223,219,210,220,200,194,193,196,198,156,155,205,154,104,103,57,58,189,218,239) ORDER BY b.weight,b.bid
This is a mystery to me! It must be something to do with the "AND b.bid IN (" part of the SQL that makes it fail. But I don't know what or why!