Here is the solution
$sql = "select id from student where classId = 5";
$view = mysql_query($sql);
while($row = mysql_fetch_array($view))
{
$array[] = $row;
}
foreach($array as $arow)
{
$sqli = "insert into course (studentId,course) values (".$ arow ["id"].",'".Maths.'")";
mysql_query ($sqli);
}
$sql = "select id from student where classId = 5";
$view = mysql_query($sql);
while($row = mysql_fetch_array($view))
{
$array[] = $row;
}
foreach($array as $arow)
{
$sqli = "insert into course (studentId,course) values (".$ arow ["id"].",'".Maths.'")";
mysql_query ($sqli);
}
No comments:
Post a Comment