PHP notification system Part-1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
our viewers in this tutorial I'm going to show you how to make a simple notification system in PHP okay so there'll be no type of opie like that okay so just as simple the recording will be going here okay so we're tabular started you need to get some knowledge about our PHP and some databases and SQL so if we don't know this thing so just pause this video and get some knowledge about those alright so let's get started so people start we need our naked databases there too we call verification so I have just to make a database here so it will need two tables for this a notification system so there is one thing that what will go with this notification system and there will be a post page okay there will a post page so easier will be now post something and it and he will and another user will receive this at the notification okay so it's just a mirror that this two page will measure by two users okay so just take itself simply alright so just to make the tables for there so one table will get post put it will be with two columns will be through the ID and it will go to increment okay save it and the title will be text let's save it and we need another table there to recall notifications it will be three rows three columns okay so faster is ID this Reagan is for title and the third one is for this the interrogation is read or not okay so in this case I'll leave it with integer and this will be - okay and just write see okay we have there are two tables here so in this case we can you can see that in this post the title and the notification has also got title all right so if you're going deeper so you just have a title and the details over here for your post so you just passed your title over Q or you don't need the details and you can also put your primary keys and stuff like that so get your now origin of post okay so I'm not just going to about the basics of it they'll just make a notification all right so what will happen so when a user make a post here this post table so then addy supposed will be posted on this repo stable and also he will get a this post title in the notification table okay so so this way the user will get done creation alright so guess let's get our coding so our index page will continue will contains the notifications part so notification okay so just to make it more visible on the eyes I am just going to import this Buddha stroke stadion okay so this is the Buddhist Obsidian here and we need also pull this trip JavaScript trials 1614 at last and we need also the jQuery stuff okay so there's endure for a little you know the coding train okay so we are just making a making a drop down here so so did too we can just take this code from here and it's pasted so what will we happen we just just refresh it it will be the notification that connection okay the drop down okay so this is the drop down that where we have just made and then in this connection dot P is connected PHP we need to connect with our database so to do that I'm going to use P do for this connection so just make the connection it will be my secure host its local host and DB name instakills notification okay so username is root as default here and password it's not already I think it will be connected but let's see again if this video and it will be eco as connected okay three people are connect dot PHP so yeah it's a connected okay so we are connected with our databases okay so where is it yeah it so we get rid of this line so we are just going to import it all of our code ok so this is the posted PHP file so we are going to post some data here so just to make the title post here and at first we include our database ok so it will be include and dot PHP yep and we just need a form here to make a post ok so just make a form just to make a style that text will be text-align:center checked for fizzy good is equal to eyes ok let's take a text area texture area and the name will be title ok I'm just a little break here and get a button for sub Lincoln input type submit name is cognate and bellow this post post okay so uniform our form action will be done in this space you would leave it blank and the method will be closed all right so just let's see if our code is working not so just paste which I started here and let's check if we set this post that we can get our post to post Chris took me then just let's echo whatever string alright so in this case we just make another tab it will call that already posted PHP up my bad scientist 0 line number two yes so what will be it will be oh yeah recognizing okay so this is our tester just leave something yes we are getting our screen here okay okay so just get rid of that and make our notification go okay so to make notification just grab our title from the text area so the to be called the closed and the title yeah and now our main stuff is going to now our main started going to work okay so we need two queries here so one query is for the making the post on the post table and another query is for to make the post on the notification table okay so just make a query here it's not clear it will be insert in to hold force and all it is all one thing here that will be called title and the bellos moving what and our values will be the post title okay so I talked and our another query queue to what we do we insert into notifications and our column name movie title and read and so it could not be read or not and the fellows will be two things that frustrate title title here and the signal read we just leave it with one so our notification is not read okay just make a flag and then we need to execute our queries so they do that query and pass our two queries here okay so after they're just eco-post it so let's see if or our this script works or not so just to make it taste hi there just post it it feels call posted so this let's see in the database if it's a fixed or not I think it affects me yes we are getting higher their post and higher in notifications so we get our notification we get our data in a notification table so you can you can really understand that so I we get a notification okay so just we need to visualize that on you define so how we can do there so we need these two up down for our notification all right so let's go to on this page okay so I'll just get rid of this stuff and our inputs here okay so at first we need to you include our connection file that will include include connect dot PHP okay so now what we will do okay so in this button there we they call this drop-down example to get rid of that just make it notification notification and we put 0 here alright we will work with it later or we will work with it here also so now our work is to get data from a notification table all right so how we could do that so we need to hound at first no and at first we need to get our data it's our just data is equals we have also created included so it will be the PDO and query only what select start from notification notification setting in the database name let's check it out these notifications okay so what will this query were these starts to grab all the notifications from the notification table okay and the we just make a count of it okay it will we call the PD the data and to count we need we have a method called row count okay and we just paste it we just make this code available in here as PHP echo count so this will this will read all the data and then average it will count the number of rows and it will return the number of rows within numbers okay so let's see if we can carry it or not let's refresh it and yes we can see that the notification is one so our there because what because why we just have one or two fication so if I paste it if I posted another post so there's another one another one posted and it will be posted and we refresh it so it your grant application is - alright so great work so now we need to also display this on the drop down alright so to do that we need to import until the PHP tag again here and start it here and we need to end it with PHP I think yep I think we need it so just leave it like there okay so in here we just get our data we are just our Gator full data from this query so we just make a loop with here there's a color for each loop check all the data as get rid of the P data is the bell okay so just card these records and put it here so it will be the loop all the data and print it here so how we can now get printed here I'll just make a face Peter and echo out our title so it will be just value and our keys title okay so I think it will be work fine so if we load that and yep we have get our all notifications here okay so just to make sure we are just going to post another post that will call the third post okay this is posted and refresh it yes we have three notification and our notifications out there so there's the our phone stable notifications so then we are going to just you know which has to make next in next episode we are going to refresh some stuff here just like we need we are going to get rid of this three notification when we click on here then it will be marked as read so the our notification will be zero okay so and we have another notification and then we will put some styling here just read one so we if we have this this modification is new so it will be colored at real and colored adds as read and and the other one will be not okay so this is our level for now so hope to see you in the next episode
Info
Channel: Shams Shahriar
Views: 10,726
Rating: undefined out of 5
Keywords: php, notification system, notification system using php, php notification system, php tutorial, shams shahriar
Id: WiFklAbV2pc
Channel Id: undefined
Length: 18min 22sec (1102 seconds)
Published: Mon Apr 09 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.