تمت عملية الاضافة بنجاح '; } else { $msg = ''; } mysqli_close($conn); } } // insert data without image|file if (isset($_POST['submit'])) { $name = $_POST['name']; $detail = $_POST['detail']; $sql = "insert into department (name,detail) values ('$name','$detail')"; include "conn.php"; $result = mysqli_query($conn, $sql); if ($result) { $msg = ''; } else { $msg = ''; } mysqli_close($conn); } // show data using table with while include "conn.php"; $sql = "select * from department"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $key = 0; while ($row = mysqli_fetch_assoc($result)) { echo ' ' . ++$key . ' ' . $row['name'] . ' ' . $row['name'] . ' edit delete '; } } else { echo ' لا يوجد بيانات يمكن عرضها... '; } // show data with foreach include "conn.php"; $sql = "select * from department"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { foreach ($result as $key => $row) { echo ' ' . ++$key . ' ' . $row['name'] . ' ' . $row['name'] . ' edit delete '; } } else { echo ' لا يوجد بيانات يمكن عرضها... '; } //show data from two table include "conn.php"; $sql = "select students.id,students.name,students.email,students.age, students.address,students.phone,department.id as dId,department.name as dName from students join department on students.depnum=department.id "; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $key = 0; while ($row = mysqli_fetch_assoc($result)) { echo ' ' . ++$key . ' ' . $row['name'] . ' ' . $row['email'] . ' ' . $row['age'] . ' ' . $row['address'] . ' ' . $row['phone'] . ' ' . $row['dName'] . ' edit delete '; } } else { echo ' لا يوجد بيانات يمكن عرضها... '; } //search from data in database include "conn.php"; if (isset($_POST['submit'])) { $name = $_POST['name']; $sql = "select students.id,students.name,students.email,students.age, students.address,students.phone,department.id as dId,department.name as dName from students join department on students.depnum=department.id where students.name like '%$name%' "; } else { $sql = "select students.id,students.name,students.email,students.age, students.address,students.phone,department.id as dId,department.name as dName from students join department on students.depnum=department.id "; } $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $key = 0; while ($row = mysqli_fetch_assoc($result)) { echo ' ' . ++$key . ' ' . $row['name'] . ' ' . $row['email'] . ' ' . $row['age'] . ' ' . $row['address'] . ' ' . $row['phone'] . ' ' . $row['dName'] . ' edit delete '; } } else { echo ' لا يوجد بيانات يمكن عرضها... '; } //show data in select //SLIDER BY FOREACH --------------------------------------------------------fullSlider----------------------------------- سلايدر
-------------------------------------------------------end-------------------------------------------- //edit data with image|file if (isset($_GET['id'])) { include "conn.php"; $sqlGetDepData = "select * from department where id=" . $_GET['id']; $result = mysqli_query($conn, $sqlGetDepData); $row = mysqli_fetch_assoc($result); if (isset($_POST['submit'])) { $name = $_POST['name']; $detail = $_POST['detail']; if (file_exists($_FILES['image']['tmp_name'])) { $old_img_path = "../images/" . $row['image']; unlink($old_img_path); $new_img_name = $_FILES['image']['name']; $expload_name = explode(".", $new_img_name); $ext = end($expload_name); $imageName = "img" . time() . "." . $ext; move_uploaded_file($_FILES['image']['tmp_name'], '../images/' . $imageName); $sql = "update department set name='$name',detail='$detail',image='$imageName' where id=" . $_GET['id']; $res = mysqli_query($conn, $sql); header('location:depshow.php?success=true'); exit(); } else { $sql = "update department set name='$name',detail='$detail' where id=" . $_GET['id']; $res = mysqli_query($conn, $sql); header('location:depshow.php?success=true'); exit(); } } }v // edit data without image if (isset($_GET['id'])) { include "conn.php"; $sqlGetDepData = "select * from department where id=" . $_GET['id']; $result = mysqli_query($conn, $sqlGetDepData); $row = mysqli_fetch_assoc($result); if (isset($_POST['submit'])) { $name = $_POST['name']; $detail = $_POST['detail']; $sql = "update department set name='$name',detail='$detail',image='$imageName' where id=" . $_GET['id']; $res = mysqli_query($conn, $sql); header('location:depshow.php?success=true'); exit(); } } // delete data with image|file if (isset($_GET['id'])) { include 'conn.php'; $querySelect = 'select * from department where id=' . $_GET['id']; $ResultSelectStmt = mysqli_query($conn, $querySelect); $fetchRecords = mysqli_fetch_assoc($ResultSelectStmt); $createDeletePath = '../images/' . $fetchRecords['image']; if (unlink($createDeletePath)) { $sql = "delete from department where id=" . $_GET["id"]; $rsDelete = mysqli_query($conn, $sql); if ($rsDelete) { header('location:depshow.php?success=true'); exit(); } } } // delete data without image|file if (isset($_GET['id'])) { include 'conn.php'; $sql = "delete from department where id=" . $_GET["id"]; $rsDelete = mysqli_query($conn, $sql); if ($rsDelete) { header('location:depshow.php?success=true'); exit(); } } // logout code session_start(); if (isset($_SESSION['id'])) { session_destroy(); header('location:login.php'); } // login code $msg = ""; if (isset($_POST['submit'])) { $username = htmlspecialchars($_POST['username']); $password = $_POST['password']; if (empty($username)) { $msg = ""; } elseif (empty($_POST['password'])) { $msg = ""; } else { include "conn.php"; $sql = "select * from users where username='$username' and password='$password'"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) == 0) { $msg = ""; } else { $user = mysqli_fetch_assoc($result); $_SESSION['id'] = $user['id']; header('Location:home.php'); } } } // check user is login! //put this code in all page session_start(); if (!isset($_SESSION['id'])) { header('Location:login.php'); } ------------------------------------------------------------------------------- //show data from select //$msg
--------------------------------------------------------------------------EndOfTheWord--------------------------------------------------------------------------------- ----------------------------------FormBloggerMostWanted----------------------------- تسجيل دخول لوحة التحكم لاتترك كلمة المرور فارغة '; } else if (empty($username)) { $msg .= ''; } else { $get_date = mysqli_query($connection, "SELECT * FROM users WHERE users.username='$username' and users.password='$password'"); $row_num = mysqli_num_rows($get_date); if ($row_num == 0) { $msg .= ''; } else { $msg .= ''; $row = mysqli_fetch_assoc($get_date); $_SESSION['username'] = $row['username']; $_SESSION['am_I_admin'] = $row['Role']; header('Location:dashbord.php'); } } } ?>

تسجيل الدخول

----------------------------------------------------------------------------------------------------------------------------------edn blog add exeam.2021 غرفة المقالات

إضافة مقال جديد

-------------------------------------------------------------------------------------------------------------------- ahemt dagga add ------------------- login

لوحة التحكم

إضافة وجبة جديدة

إلغاء
...

Some quick example text to build on the card title and make up the bulk of the card's content.

...

Some quick example text to build on the card title and make up the bulk of the card's content.

...

Some quick example text to build on the card title and make up the bulk of the card's content.

...

Some quick example text to build on the card title and make up the bulk of the card's content.

----------------------------------------------------------------------------------------- end ahmet dagga add