i can't get this from working. i want to execute these two queries ebcause i want to insert data to two separate table.
is it possible to do this with one query?
this is what i've got so far:
$sql = "INSERT INTO login SET
studNo = $studNo,
userName = $user,
password = $pass,
dateRegistered = NOW()";
$sql2 = "INSERT INTO users SET
studNo = $studNo,
lastName = $lName,
firstName = $fName,
gender = $gender,
bMonth = $month,
bDay = $day,
bYear = $year,
address = $address,
cellNo = $phone,
email = $email";
if(mysql_num_rows(@mysql_query("SELECT * FROM classlist WHERE num = '$studNo'"))) {
if(mysql_num_rows(@mysql_query("SELECT studNo FROM login WHERE studNo = '$studNo'"))) {
$flag = true;
$headMsg = "Registration Error";
$msg = "You have already registered.";
}
else{
@mysql_query($sql);
@mysql_query($sq2);
}
}
else {
$flag = true;
$headMsg = "Registration Unsuccessful";
$msg = "Your student number doesn't exist in the database.";
}