PHP-and-MySQL/C2/Common-Errors-Part-3/English-timed

From Script | Spoken-Tutorial
Revision as of 11:49, 10 July 2014 by Pratik kamble (Talk | contribs)

Jump to: navigation, search
Time Narration
00:00 Right now I am onto the last two common errors that I have included.
00:05 And we will start with the hard one.
00:09 This is php header and we are using "header" function going to a location.
00:14 And here I have got some html code.
00:18 This is a header tag, I am saying "Welcome!".
00:21 And our "goto" variable is "google dot com".
00:26 If the "goto" exists, which it currently does, we are going to redirect the page to a u-r-l "google dot com".
00:35 Right now, this will return an error.
00:37 And the error is - Oh! um... Okay that’s why. "o b start".
00:50 Lets get rid of this. That wasn’t supposed to be there. That code is to fix the error!
00:56 Sorry, so we will go to "php header" and we have got "Welcome!" - our html code.
01:03 Then a warning - "Cannot modify header information – headers already sent by..." and all of this.
01:10 Okay so our headers have already been sent. This is the line no. by the way.
01:16 1, 2, 3 so if it gives you an error like "phpheader dot php" colon 3, then the error has occurred on the line no. 3.
01:26 So that's where the error is - on line 3, okay?
01:32 And this error has been generated by line 9, which if you go here, is our "header" function.
01:39 So the reason that this is happening is we are already sending our html code.
01:47 If I get rid of this by commenting it, and I were to refresh then we would be redirected to google.
01:54 But the point is that we want this welcome header here.
01:59 And you can’t actually put html before a header function, going to location and other features of this function.
02:10 You shouldn't do so.
02:15 So as you saw a minute ago that is "ob underscore start".
02:20 What this does is, it fixes this problem for us.
02:25 So I can come here to "phpheader" and it works, even though I have still got my html code echoed here before my header.
02:37 So without this we get an error (pause) and with this our header works fine, okay?
02:47 Despite the initial rule of no html output before header up here.
02:53 That should be pretty clear by now.
02:55 Now, the last one is extremely simple.
02:58 I don’t even need to explain it but anyway.
03:02 This is "include a file which doesn’t even exist" named as "idontexist dot php".
03:08 So lets have a look. Um.. where is it? "missing dot php".
03:13 Oh no! Its not. "open dot php".
03:16 Okay! So - include "idontexist dot php" failed to open stream; no such file or directory in that name here.
03:25 Our file name and directory on line 3.
03:27 So lets come to line 3.
03:30 And that is the only line of significant code in this file.
03:35 We have another warning here - Failed to open "idontexist dot php" for inclusion and all of this. So we get two errors.
03:43 This is quite messy when you have a page that has "include a header file".
03:50 Then these don’t look too nice. I mean you have probably been in a website before and you have seen this at the top.
03:57 You need to be attractive. So you can put a "@ (at)" symbol in front and refresh.
04:02 That won't show the error anymore.
04:06 But it doesn’t excuse the fact that the file doesn’t exist.
04:10 So the content of the file which doesn’t exist, won’t be included.
04:14 But yes, to be honest, looking at this, this is really pretty much self explanatory. I just thought I should explain this anyways.
04:23 So we have got a small collection of errors that you might come across when you are programming in php.
04:30 If there are other errors that you are getting, then please message me and I will be happy to help.
04:39 Please subscribe for latest updates. Thanks for watching. This is Evan Varkey dubbing for the Spoken Tutorial project.

Contributors and Content Editors

Minal, Pratik kamble, Sandhya.np14