Return to Snippet

Revision: 44930
at April 20, 2011 23:37 by BrianHanly


Initial Code
<?
include('connect.php');


$name = $_POST['coursecode'];
$time = $_POST['time'];
$day = $_POST['day'];
$fid = $_GET['id'];
echo $var4;
echo $name."&nbspat&nbsp".$time."&nbspDays of:&nbsp".$day."<br>";

$pulldata = "Select * from class where className ='".$name."'";
echo $pulldata . "<br><br>";
$result = mysql_query($pulldata);
$insertdata = "INSERT into class (className,day,time) VALUES ('"
            . $name . "','"
			. $day .  "','"
			. $time	.	"')";

echo $insertdata;

// Insert the class into the enrollment table
$enrollQuery = "Insert into enrollment (className, fid) Values ('".$name."', '".$fid."')";

 if($row = mysql_fetch_array($result) == NULL)
	{
	mysql_query($insertdata);
			echo "<br><br>Class Has been added to the database";
			echo "<br><br>";
			
	mysql_query($enrollQuery);
			echo "Added to Enrollment Table :)";;
		}	
		else
		{
			echo "<br>Your class has already been added!";
			echo $name;
		}


?>

Initial URL

                                

Initial Description

                                

Initial Title
Classes With Friends (insertclass.php)

Initial Tags
facebook

Initial Language
PHP