我试图检查特定的rno是否存在于任何特定的表角色中。 rno和role都是从html格式获取的。有人可以帮忙吗?
<?php
$rno=$_POST['rno'];
$role=$_POST['role'];
$con = new mysqli("localhost", "root", "", "premierlg");
if ($con->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query = mysqli_query($con, "SELECT * FROM" .$rno. " WHERE rno='".$rno."'");
if(mysqli_num_rows($query) > 0){
echo "Record already exists";
}else{
echo "Dosen't exist.";
if (!mysqli_query($con,$query))
{
die('Error: ' . mysqli_error($con));
}
}
?>