Professional Documents
Culture Documents
Shanifa
Shanifa
Shanifa
File: conn.php
<?php
error_reporting(0);
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "SCHOOLSYSTEM";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
File: UserInsertion.php
<?php
include("conn.php");
$conn->close();
?>
<html>
<body>
<br/>
<a href="StudentRegistraiton.HTML"> <b> Register New Student</b></a>
</body>
</html>
retrive:
<?php
include("conn.php");
$sql = "SELECT ID, StudentName, Studentpswd, StudentCellNo, StudentEmail, FROM
student";
$result= $conn->query($sql);
?>
Deletion:
<?php
include 'conn.php';
$sql = "DELETE FROM Student WHERE ID=11";
if ($conn->query($sql)==TRUE)
{
echo "record deleted successfully";
}else{
echo "Error deleting record:". $conn->error;
}
?>
Update:
<?php
include 'conn.php';
$sql = "UPDATE teacher SET email='Ali234@gmail.com' WHERE ID=20";
if ($conn->query($sql)==TRUE)
{
echo "record updated successfully";
}else
{
echo "Error updating record:". $conn->error;
}
?>