Today I fought what I thought was some kind of permissions error. I was learning how to create a database table in mySQL with php.

After 3 hours I figured out my error was due to syntax.
“AUTO-INCREMENT” is not the same as “AUTO_INCREMENT”

I looked over that line at least a thousand times thinking - thats right.

When you are trouble shooting code:
Break down the elements.
Print out the variables print_r();
Put in escape messages while you are creating:
[code lang=”php”]
if($this_is_true){
print(”Its all good
“);
} else {
print(”Houston, we’ve got a problem”);
}
[/code]

or print all the elements getting $_POSTED:[code lang=”php”]
print_r($_POST);
[/code]

or print all the elements in an array:[code lang=”php”]
print_r($myArray);
[/code]

…it only takes a few seconds to code that temporarily in to your code to help find problems.


Post A Comment