Ошибка установки связи с курсом.

$curPage:
int(18135)
$Qset:
array(53) { [0]=> array(2) { ["id"]=> int(31707) ["page"]=> int(32413) } [1]=> array(2) { ["id"]=> int(31710) ["page"]=> int(31714) } [2]=> array(2) { ["id"]=> int(31622) ["page"]=> int(10831) } [3]=> array(2) { ["id"]=> int(31625) ["page"]=> int(10831) } [4]=> array(2) { ["id"]=> int(26038) ["page"]=> int(26024) } [5]=> array(2) { ["id"]=> int(25210) ["page"]=> int(25211) } [6]=> array(2) { ["id"]=> int(21396) ["page"]=> int(21397) } [7]=> array(2) { ["id"]=> int(17855) ["page"]=> int(17856) } [8]=> array(2) { ["id"]=> int(17615) ["page"]=> int(17611) } [9]=> array(2) { ["id"]=> int(16517) ["page"]=> int(25243) } [10]=> array(2) { ["id"]=> int(16327) ["page"]=> int(10128) } [11]=> array(2) { ["id"]=> int(15945) ["page"]=> int(15953) } [12]=> array(2) { ["id"]=> int(14266) ["page"]=> int(14235) } [13]=> array(2) { ["id"]=> int(14182) ["page"]=> int(14133) } [14]=> array(2) { ["id"]=> int(13930) ["page"]=> int(7731) } [15]=> array(2) { ["id"]=> int(13414) ["page"]=> int(13413) } [16]=> array(2) { ["id"]=> int(11887) ["page"]=> int(11885) } [17]=> array(2) { ["id"]=> int(8981) ["page"]=> int(31616) } [18]=> array(2) { ["id"]=> int(8774) ["page"]=> int(8776) } [19]=> array(2) { ["id"]=> int(7986) ["page"]=> int(9185) } [20]=> array(2) { ["id"]=> int(7984) ["page"]=> int(475) } [21]=> array(2) { ["id"]=> int(7981) ["page"]=> int(15116) } [22]=> array(2) { ["id"]=> int(7979) ["page"]=> int(4997) } [23]=> array(2) { ["id"]=> int(7976) ["page"]=> int(4997) } [24]=> array(2) { ["id"]=> int(7974) ["page"]=> int(317) } [25]=> array(2) { ["id"]=> int(7972) ["page"]=> int(409) } [26]=> array(2) { ["id"]=> int(7970) ["page"]=> int(406) } [27]=> array(2) { ["id"]=> int(7968) ["page"]=> int(14634) } [28]=> array(2) { ["id"]=> int(7966) ["page"]=> int(8901) } [29]=> array(2) { ["id"]=> int(7964) ["page"]=> int(389) } [30]=> array(2) { ["id"]=> int(7961) ["page"]=> int(8913) } [31]=> array(2) { ["id"]=> int(7959) ["page"]=> int(13174) } [32]=> array(2) { ["id"]=> int(7957) ["page"]=> int(16138) } [33]=> array(2) { ["id"]=> int(7955) ["page"]=> int(18235) } [34]=> array(2) { ["id"]=> int(7953) ["page"]=> int(16335) } [35]=> array(2) { ["id"]=> int(7951) ["page"]=> int(422) } [36]=> array(2) { ["id"]=> int(7949) ["page"]=> int(432) } [37]=> array(2) { ["id"]=> int(7947) ["page"]=> int(15111) } [38]=> array(2) { ["id"]=> int(7944) ["page"]=> int(11070) } [39]=> array(2) { ["id"]=> int(7941) ["page"]=> int(316) } [40]=> array(2) { ["id"]=> int(7935) ["page"]=> int(15082) } [41]=> array(2) { ["id"]=> int(7933) ["page"]=> int(440) } [42]=> array(2) { ["id"]=> int(7931) ["page"]=> int(4007) } [43]=> array(2) { ["id"]=> int(7928) ["page"]=> int(10009) } [44]=> array(2) { ["id"]=> int(7923) ["page"]=> int(452) } [45]=> array(2) { ["id"]=> int(7920) ["page"]=> int(14597) } [46]=> array(2) { ["id"]=> int(7907) ["page"]=> int(8940) } [47]=> array(2) { ["id"]=> int(7903) ["page"]=> int(449) } [48]=> array(2) { ["id"]=> int(8189) ["page"]=> int(380) } [49]=> array(2) { ["id"]=> int(7885) ["page"]=> int(17911) } [50]=> array(2) { ["id"]=> int(8525) ["page"]=> int(467) } [51]=> array(2) { ["id"]=> int(8521) ["page"]=> int(470) } [52]=> array(2) { ["id"]=> int(8517) ["page"]=> int(456) } }
index:
bool(false)