<?php
$servername = 'localhost';
$username = 'root';
$password = 'helloworld';
$dbname = 'campus';
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
ini_set('display_errors', 1);
error_reporting(E_ALL);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$adminuser = $_POST["textname"];
$adminpass = $_POST["pass"];
$sql = "SELECT name,password FROM admin where name='$adminuser' and password='$adminpass';";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) > 0)
{
echo "Welcome $adminuser
" ;
$sql2 = "SELECT * FROM company;";
$result2 = mysqli_query($conn, $sql2);
if(mysqli_num_rows($result2))
{
echo "table, th, td {
border: 1px solid black;" ;
echo "" ;
//echo "" ;
echo "
Company Details" ;
echo "" ;
echo "
" ;
while($row = mysqli_fetch_assoc($result2))
{
echo "" ;
echo " " ;
echo " " ;
echo " " ;
echo "
" ;
}
echo "" ;
echo "
Name |
---|
Name | Post Job | Salary | GPA | Email |
---|
" . $row["name"] . " | " . $row["post_job"] . " | " . $row["salary"] . " | " . $row["eligibility_criteria"] . " | " . $row["email"] . " |
" ;
echo "
" ;
$sql3 = "SELECT * from students ;" ;
$result3 = mysqli_query($conn,$sql3);
if(mysqli_num_rows($result3))
{
echo "table, th, td {
border: 1px solid black;
}" ;
echo "
Student Details" ;
echo "
" ;
echo "" ;
while($row = mysqli_fetch_assoc($result3))
{
echo " " ;
//echo "" ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo " " ;
echo "
" ;
}
echo '' ;
echo '
NAME | MOB.NO | GENDER | EMAIL | PREF.LOC | ADDRESS | SSLC | HSC | CGPA | LANGUAGES | INTERNSHIPS | APPLIED JOB |
---|
" . $row["name"] . " | Mobile No | " . $row["mobile_no"] . " | " . $row["gender"] . " | " . $row["email"] . " | " . $row["preferred_loc"] . " | " . $row["address"] . " | " . $row["sslc"] . " | " . $row["hsc"] . " | " . $row["cgpa"] . " | " . $row["languages"] . " | " . $row["internships"] . " | " . $row["applied_job"] . " |
' ;
echo "
LOGOUT";
}
}
}
else
{
echo "Invalid username or password" ;
echo "
BACK" ;
}
mysqli_close($conn);
?>
What I have tried:
I need it fro my school mini project