我正在尝试在用户登录时启动3个会话
但是唯一正在开始的会话是$email=$_POST['email']
这是我的代码。
if(isset($_POST['log'])) // code to be executed when login button is clicked
{
$email=$_POST['email'];
$password=$_POST['Password'];
$query= "SELECT * FROM student
WHERE EmailAddress = '$email' AND Password = '$password'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)>0)
{
//checks the database where this user exist or not
$_SESSION['email']=$email;
$_SESSION['StudentID']=$student;
$_SESSION['OfferingID']=$Offering;
header('location: profile.php'); //
}
else
{
echo '<script type = "text/javascript"> alert("Invalid Credentials or Not yet registered!") </script>';
}
}
答案 0 :(得分:1)
假设studentID和产品来自数据库记录,您需要获取数据并从提取的记录中提取这些字段。
像...一样的东西。
$student = mysqli_fetch_assoc($query_run);
$_SESSION['email']=$email;
$_SESSION['StudentID']=$student['studentID'];
$_SESSION['OfferingID']=$student['OfferingID'];
答案 1 :(得分:0)
首先在您的代码中获取$ student和$ offer条件
if(isset($_POST['log'])) // code to be executed when login button is clicked
{
$email=$_POST['email'];
$password=$_POST['Password'];
$query= "SELECT * FROM student
WHERE EmailAddress = '$email' AND Password = '$password'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)>0)
{
//fetch array and get values for studentid and offeringid
$student = mysqli_fetch_assoc($query_run);
$_SESSION['email']=$email;
$_SESSION['StudentID']=$student['studentID'];
$_SESSION['OfferingID']=$student['OfferingID'];
header('location: profile.php'); //
}
else
{
echo '<script type = "text/javascript"> alert("Invalid Credentials or Not yet registered!") </script>';
}
}
在这里我再次设置检查
答案 2 :(得分:0)
def send_compute_to_client():
time.sleep(20)
print("Sleep over")
for _, client_sock in client_name_to_sock_mapping.iteritems():
print("client = {}".format(client_sock))
client_sock.sendall("COMPUTE 1,2,3")
print("send completed = {}".format(client_sock))
data = client_sock.recv(1024)
print("Computed results from client {}".format(data))
我已经编辑了我的答案..
只需检查正确的字段和表名称。
其余代码设置为
快乐的编码...