├── README.md
├── functions.php
├── index.php
├── notificationsystem.sql
└── view.php
/README.md:
--------------------------------------------------------------------------------
1 | # NotificationSystemInPHP
2 | Notification System in PHP ang MySql like facebook
3 |
--------------------------------------------------------------------------------
/functions.php:
--------------------------------------------------------------------------------
1 | query($query);
10 | return $stmt->fetchAll();
11 | }
12 | function performQuery($query){
13 | $con = new PDO(DBINFO, DBUSER, DBPASS);
14 | $stmt = $con->prepare($query);
15 | if($stmt->execute()){
16 | return true;
17 | }else{
18 | return false;
19 | }
20 | }
21 |
22 | ?>
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Notification System in PHP and MySql
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
107 |
108 |
109 |
110 |
111 |
Bootstrap starter template
112 |
Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/notificationsystem.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 4.7.4
3 | -- https://www.phpmyadmin.net/
4 | --
5 | -- Host: 127.0.0.1
6 | -- Generation Time: Feb 11, 2018 at 03:07 AM
7 | -- Server version: 10.1.30-MariaDB
8 | -- PHP Version: 7.2.1
9 |
10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 | SET AUTOCOMMIT = 0;
12 | START TRANSACTION;
13 | SET time_zone = "+00:00";
14 |
15 |
16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19 | /*!40101 SET NAMES utf8mb4 */;
20 |
21 | --
22 | -- Database: `notificationsystem`
23 | --
24 |
25 | -- --------------------------------------------------------
26 |
27 | --
28 | -- Table structure for table `notifications`
29 | --
30 |
31 | CREATE TABLE `notifications` (
32 | `id` int(11) NOT NULL,
33 | `name` text NOT NULL,
34 | `type` text NOT NULL,
35 | `message` text NOT NULL,
36 | `status` text NOT NULL,
37 | `date` datetime NOT NULL
38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39 |
40 | --
41 | -- Dumping data for table `notifications`
42 | --
43 |
44 | INSERT INTO `notifications` (`id`, `name`, `type`, `message`, `status`, `date`) VALUES
45 | (10, '', 'comment', 'Hi crush', 'read', '2018-02-09 00:21:21'),
46 | (11, 'Irene', 'like', '', 'read', '2018-02-09 00:21:34'),
47 | (12, 'Joe', 'like', '', 'unread', '2018-02-09 00:22:25');
48 |
49 | --
50 | -- Indexes for dumped tables
51 | --
52 |
53 | --
54 | -- Indexes for table `notifications`
55 | --
56 | ALTER TABLE `notifications`
57 | ADD PRIMARY KEY (`id`);
58 |
59 | --
60 | -- AUTO_INCREMENT for dumped tables
61 | --
62 |
63 | --
64 | -- AUTO_INCREMENT for table `notifications`
65 | --
66 | ALTER TABLE `notifications`
67 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
68 | COMMIT;
69 |
70 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
71 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
72 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
73 |
--------------------------------------------------------------------------------
/view.php:
--------------------------------------------------------------------------------
1 | Notifications
2 |
3 | 0){
14 | foreach(fetchAll($query) as $i){
15 | if($i['type']=='like'){
16 | echo ucfirst($i['name'])." liked your post.
".$i['date'];
17 | }else{
18 | echo "Some commented on your post.
".$i['message'];
19 | }
20 | }
21 | }
22 |
23 | ?>
24 | Back
--------------------------------------------------------------------------------