MyBB Community Forums

Full Version: What causes errors? & or how do they get there?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how do the errors get into the php files? or any others? or what are the ways they can get corrupted?
such as suntax errors? or any others?

and is this the same kind of errors that shows up on ones loser left bottom corner of the main page where the "done" word is usually found with a yellow triange and an exclamation mark in it.
theres a line error mesage usually, are these related and can these be repaired on through opening up thes files and deleteing the errors, with caution of course?


--------------------------------------------------------------------------------
Pow-Mia Wrote:how do the errors get into the php files? or any others? or what are the ways they can get corrupted?
such as suntax errors? or any others?
Syntax/Parse Errors
If you type something wrong and cause the PHP parser to not understand what you're trying to say. Since computers are stupid, it will let you know when it doesn't know how to handle something.
Examples of parse errors/syntax errors:
$text = "I would like to quote Chris Boulton, who said, "I broke MyBB again." I think that is a great quote which should be put on a t-shirt";
// problem here is that you didn't escape the quotation marks within the string.

for(i = 0; i < 100; ++i)
{
    echo i;
}
// for the above, forgot to add $ in front of the variable name, so PHP thinks it's a constant, but it hasn't been defined, so it pouts. (also even if it's defined, constants cannot change in value)

echo "Happy Birthday Dennis"
$dennis_age++;
// forgot to put semicolon after the echo line.
And those aren't all...it's impossible to encompass all the errors you could get Toungue

Logic Errors
Another type of error is logic errors (PHP won't let you know, so they are really "bugs" that you have to find yourself). It's like:
// print out numbers from $i to $j
$i = 10;
$j = 20;
for($i = 0; $i < $j; ++$i)
{
  echo "$i ";
}
// but this code actually prints out numbers from 0 to $j
The code doesn't do what it's meant to do, but it's syntactically correct. However, PHP does let you know about some logic errors when they become "fatal" to the server, such as:
$i = 0;
while($i < 100)
{
   echo "$i ";
}
// infinite loop, forgot to add ++$i;

Pow-Mia Wrote:and is this the same kind of errors that shows up on ones loser left bottom corner of the main page where the "done" word is usually found with a yellow triange and an exclamation mark in it.
theres a line error mesage usually, are these related and can these be repaired on through opening up thes files and deleteing the errors, with caution of course?

The yellow triangle with the exclamation mark in Internet Explorer means there's a Javascript error. Again it's usually because the Javascript parser in your browser doesn't understand something you put (maybe you misspelled something).
I've neve been know to mispell anything that im aware ofToungue

Wow, Dennis youre thourough, thanks !
nice job on the Quick tutorial here!
great job on the colored text, also!

that was fast for a person to knock that out, in the short amount of time after i posted this.
But arent you stretching the truth, literally beyond or without its page limits here?Toungue
its like you done this script writing a time or two?
I have to go around the corner to find my edit button with all my mispelled words, you forgot to edit for meToungue
and save changes button too, , btw loser is spelled lower , for those that cant read or understand my hyroglyphics