与朋友一起上课(插入类.php)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了与朋友一起上课(插入类.php)相关的知识,希望对你有一定的参考价值。

  1. <?
  2. include('connect.php');
  3.  
  4.  
  5. $name = $_POST['coursecode'];
  6. $time = $_POST['time'];
  7. $day = $_POST['day'];
  8. $fid = $_GET['id'];
  9. echo $var4;
  10. echo $name."&nbspat&nbsp".$time."&nbspDays of:&nbsp".$day."<br>";
  11.  
  12. $pulldata = "Select * from class where className ='".$name."'";
  13. echo $pulldata . "<br><br>";
  14. $result = mysql_query($pulldata);
  15. $insertdata = "INSERT into class (className,day,time) VALUES ('"
  16. . $name . "','"
  17. . $day . "','"
  18. . $time . "')";
  19.  
  20. echo $insertdata;
  21.  
  22. // Insert the class into the enrollment table
  23. $enrollQuery = "Insert into enrollment (className, fid) Values ('".$name."', '".$fid."')";
  24.  
  25. if($row = mysql_fetch_array($result) == NULL)
  26. {
  27. mysql_query($insertdata);
  28. echo "<br><br>Class Has been added to the database";
  29. echo "<br><br>";
  30.  
  31. mysql_query($enrollQuery);
  32. echo "Added to Enrollment Table :)";;
  33. }
  34. else
  35. {
  36. echo "<br>Your class has already been added!";
  37. echo $name;
  38. }
  39.  
  40.  
  41. ?>

以上是关于与朋友一起上课(插入类.php)的主要内容,如果未能解决你的问题,请参考以下文章

与朋友一起上课(myclasses.php文件)

与朋友一起上课(索引.php)

与朋友一起上课(用户.php)

与朋友一起使用超类的私有变量

开学啦,LUA准备好了!

详解PHP反射API