[Solved] Getting many syntax errors in my PHP code [closed]


If you have no idea, then at least Google search the type and name of the error – the error log does give you plenty enough information to solve your error. +1 for using the error log, -1 for not actually reading and using the information it gives you.

To give some more detail: the core of your errors is that you’re not writing the PHP correctly, so this implies you don’t know PHP, so really what you should be doing is not running before you can crawl and going away and reading up all about PHP and the structure and layout and methods behind the language and how to get intended results from the code you write.

Pretty much all your errors are down to bad syntax, I could rewrite the whole code block for you and format it correctly but really I think it’s better for you to go away and read about how to structure IF statements, how to use strpos and how to open and edit files as starting points.
Also read up about how to structure arrays and google search info on how to structure Multidimensional arrays (as that’s another syntax fault in your code).

And seriously, I do mean well done for using the error log. Many programmers in PHP merrily get things mostly working and completely ignore learning how to detect and collect their non-critical errors.

Some further pointers to this specific code:

  • check each instruction ends with a ;
  • check the difference between $_GET and $_POST, read about them in php.net, also read about what these identifiers actually are (they’re special).
  • be careful with print and echo statements that the character they open with (" or ') is escaped (ie preceded by a backslash) if found inside the string.
  • check that multidimensional arrays are structured correctly – $array[0][1] NOT $array[0[1]]
  • check the URL to the files you want to use is correct.
  • Eat 5 different pieces of fruit or veg a day

2

solved Getting many syntax errors in my PHP code [closed]