« on: 26 Oct 2019, 12:12:38 pm »
The following are guidelines, designed to help get your PHP questions answered.
- Installation
Can you run phpinfo();?
If not, this is a guide to installing with a troubleshooting guide, and this guide is for help on getting started with the basics of running PHP scripts.
- php.ini
What errors have you got? If you have a blank screen, make sure error_reporting and display_errors are switched on in your php.ini file*, the errors given will point you in the right direction but do not always point to the actual cause of the error.
*Make sure that display_errors is switched off when made public, and enable error_logging if not already done.
- HTML
For all but the simplest of PHP scripts, a good understanding and knowledge of HTML is fundamental, a well structured document is a lot easier to code for.
- Syntax
Dotting the i’s and crossing the t’s, punctuation errors are often the cause of sleepless nights, hours of puzzlement and hair ripping. Most text editors designed for coding can really help here as they have various ways of gently pointing out that you’re missing a ; or a closing brace etc.. have read of the HTML guidelines for some suggestions or you can check online if you need to, they can often help as they are not so subtle.
Checkers and highlighters can only point out syntactical errors, in most cases they cannot work out if your code will work; some will kindly point out unused variables and dead ends
The complete PHP language reference is here, carefully check that you have followed the correct format.
The PHP manual provides a function reference, to access it replace the function name in the following link:
https://www.php.net/manual/en/function.function_name_here.php, e.g. https://www.php.net/manual/en/function.echo.php. The manual gives the latest information, detailing any changes that have been made to the function and from which version it applies.
- Posting code
Use [сode][/сode] tags when posting code, it’s so much easier to read.
Whitespace is free, it makes your code easier to read when used correctly.
You can format your code online here but formatting code in your editor will help you more and makes it easier to copy to paste in code blocks.
The style isn’t as important as the consistency of formatting.
Post all relevant code, PHP can spread over several files, without seeing the whole picture it’s difficult to diagnose. If you have an error, show the complete error and the whole script identified in the error description.
« Last Edit: 26 Oct 2019, 12:14:25 pm by ian »
Logged
Our desire for order and definition is often outweighed by our ability.