#1
| |||||
| |||||
PHP Frequent errors Frequent PHP errors Suppose there is an error in your script and your script is only half or even not at all. Say that your PC does not make a mistake in the script because a computer is never wrong. What should you look at a mistake and how you get the problem? In any event, not a topic on the forum where you display the error and your whole code with the question like "Dissolve this out for me please." so Go look for yourself what the problem might be and if you want you can obviously go to the forum. What errors are there? 1.Fatal error Error while running the script. The execution of the script should be stopped. Quote:
2.Warning An error during the execution of the script. The fault is not so bad that the script must be stopped. Quote:
3.Parse error A compilation error. This occurs when you use a wrong syntax. The script can not be started. Quote:
4.Notice Whether this error is shown is the configuration of your server (details on next page). these are just observations, which could indicate an error, but it does not. Quote:
Note: PHP is not always the correct line number where the error occurred. It is in these cases helpful to the previous and next line of error checking. Say you get an error This means that you have a full white screen. You can then top of your script put the following: php: Quote:
More information about the error_reporting function and how to configure php.ini can be found in the php manual |
#2
| |||
| |||
Re: PHP Frequent errors What to do if you have errors? => Debugging Test your page in pieces by regularly printing some information so you can easily see where the script is the true wrong. For example, if nothing happens to your variables, you print variable than once to see whether that is the right value. Often makes mistakes in subarrays, eg requesting something with $ array [subarray] or $ array [ '$ i']. Remember also that programming languages start counting at 0 and not 1! Debugging arrays: php: Quote:
Debugging SQL Queries: Also working with SQL queries is sometimes useful to echo in your document to see what query your SQL server now receives. A solution could include: php: Quote:
|
#3
| |||
| |||
Re: PHP Frequent errors Frequent PHP errors Here we give an overview of the errors that are very often, and however easily remedied. A) forget: This is a common mistake. If you control structures like while, for, foreach, if / else are working and a final accolade forget you get an error in the last brace of the script, or after no more braces are, on the last line of the script. This is a difficult mistake because sometimes your whole script should look for the fault to be found. Some tips to avoid this error: make your code indentation with each level you make it so you can quickly see which brace belongs to which structure and where there is a missing brace. Another important tip is that if you work with a control structure, you immediately after you put the opening brace is the final accolade places. This ensures that they subsequently can not forget. ; Or forgotten: typed: In this case you get an error message on the next line. 'And' swap: You often against people who have a string with double quotation stabbing begin with a single quotation stabbing end. This does not! You must finish with the same string citation stabbing started as you are. Remember this definitely: Within double quotes are parsed variables. You should always beware of double quotes: you must often dangerous characters ( "$ ...) escaping through a \ continue) Within single quotes, the string literal as text appearance, there are no variables parsed. It is therefore no need for dangerous characters ( "$ ...) to escape. Headers already sent by: This error is common when your cookies, sessions or header refers ring. These functions must be called before any HTML is executed. It should therefore not sent information to the client when you use these functions. protecol works with the http headers with information about the object to questions once you start sending the contents of a document, the html so (one is enough space or enter). header can not be changed and you get a php error. that is to solve the brackish method ob_start () and ob_flush and (), that hold the page at all on the server until you do flusht at the bottom of the script. Not recommended for slow connections or a large website so. A better solution is just to important php calculations and adjustments to the header to obtain data that is sent to the client. also set cookie in the header header example of wikipedia Code: Quote:
|
#4
| |||
| |||
Re: PHP Frequent errors Variables echoing The echoing of variables and html tags (double quotes) is often found difficult by beginners and advanced. there are a few handy ways to remedy. For easy html tags to display is the easiest to strings between sinlequotes ( ') to double quotes ( ") m which saves a lot of problems with scripts What often happened to be echoing variables is that people simply use the tags: php: Quote:
php: Quote:
The disadvantage of using single quotes is that there are no escaped charactars "are parsed, a solution may, for example, are using a constant, which can not single and double quotes need to be used together. php: Quote:
|
![]() |
|
Tags: error, php |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Google Chrome 13 on Linux showing frequent Aww Snap errors | LavinaD | Technology & Internet | 4 | 14-09-2011 10:28 PM |
MTS Mblaze frequent disconnection | S-Waugh | India BroadBand | 4 | 21-11-2010 05:21 AM |
Frequent Restarts (Bugcheck) Please Help!! | vinay016 | Operating Systems | 1 | 04-08-2009 10:29 PM |
Most frequent use of your Computer? | Ekavir | Polls & Voting | 8 | 06-10-2008 07:39 PM |
Frequent Screen Freeze | EvChrysler300 | Vista Help | 18 | 22-09-2008 12:13 PM |