Posted By

BrianHanly on 04/20/11


Tagged

with classes facebook friends


Versions (?)

Classes With Friends (insertclass.php)


 / Published in: 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. ?>

Report this snippet  

You need to login to post a comment.