File "insert.php"

Full Path: /home/analogde/www/Design/fileman/Fusion/CRUD01/insert.php
File size: 734 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
include('database connection.php');
include('function.php');
if(isset($_POST["operation"]))
{
	if($_POST["operation"] == "Add")
	{
		$statement = $connection->prepare("
			INSERT INTO course (course, students) VALUES (:course, :students)");
		$result = $statement->execute(
			array(
				':course'	=>	$_POST["course"],
				':students'	=>	$_POST["students"]
			)
		);
	}
	if($_POST["operation"] == "Edit")
	{
		$statement = $connection->prepare(
			"UPDATE course
			SET course = :course, students = :students WHERE id = :id");
		$result = $statement->execute(
			array(
				':course'	=>	$_POST["course"],
				':students'	=>	$_POST["students"],
				':id'			=>	$_POST["course_id"]
			)
		);
	}
}

?>