Home > Programming, php > php: syntax woes

php: syntax woes

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:

if($this_is_true){
  print("Its all good<br />");
} else {
  print("Houston, we've got a problem");
}

or print all the elements getting $_POSTED:

print_r($_POST);

or print all the elements in an array:

print_r($myArray);

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

Categories: Programming, php Tags:
  1. No comments yet.
  1. No trackbacks yet.