From 2b54f5f835ddacecf1a0926e023e62c8fd455cc6 Mon Sep 17 00:00:00 2001 From: Prabhakar Gupta Date: Sun, 30 Aug 2015 15:16:43 +0530 Subject: [PATCH] inital commit --- db/users.sql | 58 +++++++++++++++++++++++++++++ delete.php | 26 +++++++++++++ inc.database.php | 61 ++++++++++++++++++++++++++++++ index.php | 89 ++++++++++++++++++++++++++++++++++++++++++++ insert.php | 29 +++++++++++++++ public/css/style.css | 45 ++++++++++++++++++++++ update.php | 29 +++++++++++++++ 7 files changed, 337 insertions(+) create mode 100644 db/users.sql create mode 100644 delete.php create mode 100644 inc.database.php create mode 100644 index.php create mode 100644 insert.php create mode 100644 public/css/style.css create mode 100644 update.php diff --git a/db/users.sql b/db/users.sql new file mode 100644 index 0000000..7116b08 --- /dev/null +++ b/db/users.sql @@ -0,0 +1,58 @@ +-- phpMyAdmin SQL Dump +-- version 4.4.11 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Aug 30, 2015 at 01:22 PM +-- Server version: 5.5.44-0ubuntu0.14.04.1 +-- PHP Version: 5.5.9-1ubuntu4.11 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `basic phpmyadmin` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(11) NOT NULL, + `fname` varchar(20) NOT NULL, + `lname` varchar(20) NOT NULL, + `marks` int(10) DEFAULT '0', + `last_updated_ux` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `users` +-- +ALTER TABLE `users` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/delete.php b/delete.php new file mode 100644 index 0000000..9ef9d3f --- /dev/null +++ b/delete.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/inc.database.php b/inc.database.php new file mode 100644 index 0000000..fafe8ce --- /dev/null +++ b/inc.database.php @@ -0,0 +1,61 @@ + 0){ + mysqli_close($connectionStatus); + return $result; + } + return false; +} + +function insert_data($connectionStatus, $fname, $lname, $marks){ + $query = "INSERT INTO `users`(`fname`,`lname`,`marks`) VALUES ('$fname','$lname','$marks')"; + $result = mysqli_query($connectionStatus, $query); + + + if(mysqli_affected_rows($connectionStatus)){ + return true; + } + return false; + +} + +function update_data($connectionStatus, $id, $choice, $newValue, $marks){ + if ($choice == "marks"){ + $query = "UPDATE `users` SET `marks`='$newValue' WHERE `id`=$id"; + } else if($choice == "fname"){ + $query = "UPDATE `users` SET `fname`='$newValue' WHERE `id`=$id"; + } else if($choice == "lname"){ + $query = "UPDATE `users` SET `lname`='$newValue' WHERE `id`=$id"; + } + + $result = mysqli_query($connectionStatus, $query); + + if(mysqli_affected_rows($connectionStatus)){ + return true; + } + return false; +} + +function delete_data($connectionStatus, $id){ + $query = "DELETE FROM `users` WHERE `id` = $id"; + $result = mysqli_query($connectionStatus, $query); + + if(mysqli_affected_rows($connectionStatus)){ + return true; + } + return false; +} + + +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..a2bde4d --- /dev/null +++ b/index.php @@ -0,0 +1,89 @@ + + + + + + Basic MySQL Admin Panel + + + + +
+
+
+
+
+ + + + +
+
+
+
+ + + + +
+
+
+
+ + +
+
+
+
+

STUDENT's DATA SHEET

+ + + + + + + + + + + + + + + + "; + } +?> +
IDFirst NameLast NameMarksResult
" . $query_row["id"] . "" . $query_row["fname"] . "" . $query_row["lname"] . "" . $marks_scored . ""; + echo ($PASSING_MARKS < $marks_scored) ? 'PASS' : 'FAIL'; + echo "
+
+".$_GET["v"]."
"; + } +?> +
+
+
+ + + + + + + \ No newline at end of file diff --git a/insert.php b/insert.php new file mode 100644 index 0000000..b688a3a --- /dev/null +++ b/insert.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..60b2d62 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,45 @@ +@import url(http://fonts.googleapis.com/css?family=Roboto:400,900); +body{ + font-family: 'Roboto', sans-serif; +} +#wrapper{ + padding: 10px; + overflow: hidden; + +} + +.form-wrapper{ + border: 1px solid #DDDDDD; + padding: 5px; + margin-bottom: 5px; + text-align: center; +} + +.form-wrapper form{ + margin-bottom: 0 +} + +.form-wrapper form button{ + margin-top: 10px; +} + +#message{ + padding-top:20px; + font-weight:10px; +} +h1{ + text-align:center; +} +#success, #error{ + text-align: center; + margin-top: 40px; + font-weight: bold; +} + +#success{ + color:green; +} + +#error{ + color:red; +} diff --git a/update.php b/update.php new file mode 100644 index 0000000..4748a7e --- /dev/null +++ b/update.php @@ -0,0 +1,29 @@ + \ No newline at end of file