我正在尝试建立会议系统帽子检查参与者和房间的时间表以创建会议我在将会议的参与者添加到数据库时遇到问题它只进入一个用户不知道为什么
这是我的PHP代码
$dbhost = "127.0.0.1";
$dbuser = "root";
$dbpass = "";
$dbname = "mss";
$connection = mysql_connect($dbhost, $dbuser, $dbpass, $dbname);
if (mysql_errno()) {
die("Database Connection failed:" . mysql_error() . "(" . mysql_errno() . ")");
}
mysql_select_db('mss');
?>
<?php echo $id = (isset($_POST['id']) ? $_POST['id'] : "hello"); ?> <br>
<?php echo $title = (isset($_POST['title']) ? $_POST['title'] : "hello"); ?> <br>
<?php echo $employee = (isset($_POST['employee']) ? $_POST['employee'] : "hello"); ?> <br>
<?php
$participant = (isset($_POST['participant']) ? $_POST['participant'] : "hello");
$starttime = (isset($_POST['starttime']) ? $_POST['starttime'] : "hello");
$endtime = (isset($_POST['endtime']) ? $_POST['endtime'] : "hello");
$day = (isset($_POST['day']) ? $_POST['day'] : "hello");
$room = (isset($_POST['room']) ? $_POST['room'] : "hello");
$Lines = explode("\n", $participant);
foreach ($Lines as $line)
{
echo $line;
$q1 = "select Availability from E_schedule where Employee_name='$line' and StartTime='$starttime' and Day='$day'";
$q2 = "SELECT Availability from room_schedule WHERE r_name = '$room' AND StartTime='$starttime' and Day='$day'";
$result = mysql_query($q1, $connection);
$result1 = mysql_query($q2, $connection);
if ($result == FALSE)
{
die(mysql_error());
}
if ($result1 == FALSE)
{
die(mysql_error());
}
$info = mysql_fetch_array($result);
$info1 = mysql_fetch_array($result1);
if ($info['Availability'] == 1) {
echo ("You can't make a meeting at that time, Please Select another Day or time");
}
if ($info1['Availability'] == 1) {
echo ("You can't make a meeting at that Room, Please Select another Room");
}
else
{
$insert_meeting="insert into E_schedule (Employee_name, StartTime, EndTime, Day, Availability, Activity_Name) values ('$line', '$starttime ', '$endtime', '$day', '1', '$title')";
$insert_result = mysql_query($insert_meeting, $connection );
if($insert_result == FALSE)
{
die(mysql_error());
}
$meeting="insert into meeting (Title, StartTime, EndTime, Day, Participant, Room) values ('$title', '$starttime ', '$endtime', '$day', '$participant','$room')";
$meeting_result = mysql_query($meeting, $connection );
if($meeting_result == FALSE)
{
die(mysql_error());
}
$insert_room="insert into room_schedule (r_name,M_Title, StartTime, EndTime, Day, Availability) values ('$room','$title','$starttime ', '$endtime', '$day', '1')";
$insert_result1 = mysql_query($insert_room, $connection );
if($insert_result1 == FALSE)
{
die(mysql_error());
}
echo ("The Meeting has been Created Successfully");
}
}
?>
<br><?php echo $day = (isset($_POST['day']) ? $_POST['day'] : "hello"); ?> <br>
<?php echo $starttime = (isset($_POST['starttime']) ? $_POST['starttime'] : "hello"); ?><br>
<?php echo $endtime = (isset($_POST['endtime']) ? $_POST['endtime'] : "hello"); ?><br>
<?php echo $room = (isset($_POST['room']) ? $_POST['room'] : "hello"); ?> <br>
</body>
</html>
你能帮忙吗?
我尝试了很多东西而且没有用
提前谢谢
答案 0 :(得分:0)
你不必在mysql_connect函数中传递$ dbname。
$dbhost = "127.0.0.1";
$dbuser = "root";
$dbpass = "";
$dbname = "mss";
$connection = mysql_connect($dbhost, $dbuser, $dbpass);
我需要更多信息才能找出问题所在。发布您收到的错误消息
答案 1 :(得分:0)