i created a linked table , in my business logic , row inserting server event , i used thes queries
//remote
$studentportal = ExecuteStatement("INSERT INTO fabotasp_studentportal.users (name,firstname, othername,Matricno,examnobackup,password,status,dpt,dptcode,userlevel)
VALUES ('$name', '$firstname', '$othername','$email','$examnobackup','$password','$status','$dpt','$dptcode',1)");
// get userid on collegeportal.users tbl
$getuserid = ExecuteScalar("SELECT id FROM fabotasp_studentportal.users WHERE Matricno='$examnobackup'");
// create data in collegeportal.studentlevel
$studentlevel = ExecuteStatement("INSERT INTO fabotasp_studentportal.studentlevel (student_id, level,portalsession)
VALUES ('$getuserid', '$level', '2022/2023')");
this works well on local but when i move to remote i get
INSERT command denied to user ‘fabotasp_acctance2’@‘localhost’ for table ‘users’
alternativly i use direct mysqli() in sever event but i got error class mysqli not found. i=how do i use this ? i KNOW ITS NOT RECOMENDED BUT THIS IS A QUICK FIX FOR ME
// insert into student portal
$servername = "localhost";
$username = "sportal";
$password = "*******";
$dbname = "fabotasp_studentportal";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "INSERT INTO users (name,firstname, othername,Matricno,examnobackup,password,status,dpt,dptcode,userlevel)
VALUES ('$name', '$firstname', '$othername','$email','$examnobackup','$password','$status','$dpt','$dptcode',1)";
if ($conn->query($sql) === TRUE) {
//echo "New record created successfully";
} else {
// echo "Error: " . $sql . "<br>" . $conn->error;
}
$sql2 = "SELECT id FROM users WHERE Matricno='$examnobackup'";
$result2 = $conn->query($sql2);
if ($result2->num_rows > 0) {
// output data of each row
while($row = $result2->fetch_assoc()) {
$getuserid = $row["id"];
echo $getuserid;
}
} else {
//echo $getuserid;
}
$sql3 = "INSERT INTO studentlevel (student_id, level,portalsession)
VALUES ('$getuserid', '$level', '2022/2023')";
if ($conn->query($sql3) === TRUE) {
//echo "New record created successfully";
} else {
// echo "Error: " . $sql . "<br>" . $conn->error;
}