Difference between revisions of "PHP-and-MySQL/C2/Common-Errors-Part-3/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{| border=1 !Time !Narration |- |0:00 |Right now I am onto the last two common errors that I have included. |- |0:04 |And we will start with the hard one. |- |0:09 |This is php…')
 
 
(No difference)

Latest revision as of 19:49, 1 December 2012

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

Contributors and Content Editors

Chandrika, Pravin1389