<?php
$userinfo = mysql_query ("SELECT user_id FROM `users`");
while ($row=mysql_fetch_array($userinfo)) {
sanitize_data($row);
$user_id=$row['user_id'];
if ($row['usertype']=='Teacher') {
mysql_query("INSERT INTO teacher(teacher_id)
values('{$user_id}')");
} else {
mysql_query("INSERT INTO student(student_id)
values('{$user_id}')");
}
}
?>
Can you tell me whats wrong with my code? All I want is to add user_id into the Teacher table in teacher_id if the user type is teacher and add the user_id into the Student table in the student_id if the usertype is student. Please help me identify whats wrong thanks.