ببین این جواب میده؟

$r=mysql_query("select `stdid`,`reshte` from `source` where `year`='$_REQUEST[kyear]' and `maghta`='$_REQUEST[select]' and `reshte`='$_REQUEST[select2]'",$dbcon);
while($prow=mysql_fetch_assoc($r)){
mysql_query("insert into `source` set `stdid`='$prow[stdid]' , `year`='$_REQUEST[kyear]' , `reshte`='$prow[reshte]' , `maghta`='$magh'",$dbcon);
}

در ضمن، آیا $magh رو مقدار دهی کردی؟

کدی که گذاشته بودی میتونست درست باشه، ولی خوب مقداری نامنظم و شلوغ بود. کد بالا منظم شده و صاف و صوف شده شه.

در ضمن، مادامی که نیازی به mysql_fetch_array نداری، بهتره از mysql_fetch_assoc استفاده کنی...

موفق باشید.