The most problems that come from headers is the following error:
Quote
This error occurs when some type of data (usually an echo'd statement) is sent before you try to redirect someone. To fix it, you just need to move the redirection header up to the top of your page (around where session_start() should be if you're using it).
Other errors for headers occur when you are trying to force download things, or open images. you need to make sure you're using the correct type of header (IE: location, image/jpeg).
certain errors include sessions not holding information (the fix is usually that session_start() does not exist at the top of the page), or errors popping up (meaning session_start is not at the top of the page. it needs to be set before anything is echo'd to the page).
MySQL errors are usually very common. Following are the most common errors:
Quote
(MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
this error occurs when you're using certain functions (such as COUNT), and not having a group by at the end. Basically it is telling you that MySQL doesn't know WHAT to count.
Quote
This message usually indicates too many connections, and can be fixed by either increasing the amount of concurrent connections your DB can handle, but can usually be fixed by using mysql_close.
Quote
The above error is usually indicative of you either messing up the query that mysql_fetch_array points to, or not pointing to a query, or even that the variable you used (possibly $sql or $result) does not hold a query.
If MySQL returns 1 row less then it should (and you're positive your query is perfect), it's possible that you called something such as mysql_fetch_array or mysql_fetch_assoc once (or more) before you called it in the while loop. Remember that each call moves the pointer ahead by 1 result.
echo errors usually occur when you do not escape certain characters, such as in the following quote:
Quote
it will probably end either a white page, or a message such as :
Quote
or:
Quote
the most common error for these is flawed logic. in the following statement, the if will never be activated, always leading to the else:
<?php
if($i > 1){
echo "Activated";
}
else
{
echo "Not Activated";
}
?>
The error is that $i is never set to anything. Another error is caused by being too strict:
<?php
$i = 3;
if($i > 2 && $i < 3)
{
echo "Activated";
}
?>
Since you are too strict (IE: the variable $i needs to be between 2.000~1 to 2.99999~, it will never be activated.
Elseif are the EXACT same as if statements. however in an if/elseif/else statement, only 1 of them are activated. this means that if the IF statement is True, even if the elseif statement is true, it will NOT be activated. If you want to activate 2 of them, use 2 if statements.
Other common errors include missing Semicolons (;) at the end of a statement as below:
echo "Hello World" echo "There's a php error in here."
Depending on the server information, you'll either end up with a white page or an error message.
- Buy or Install a free trial of an IDE (Integrated Development Environment). It highlights any PHP syntax errors, and tells you what the error is. I would reccomend NuSphere PhpED
- Read the DIC Tutorials. They're very helpful and usually very informative.
- If you're going to ask DIC for help, Please don't be impatient, and make sure to tell us what is wrong. We're not going to go through your entire script just to help you unless you'retrying to help yourself as well.
- although many of us here are good at PHP or other coding languages, this does not mean we know what you're talking about. I, for one, do not know things such as Smarty or XamPP, or Apache or any of them.
- Have Fun. Help other people. If someone has helped you, chances are the time will come when you can help them back. All of us usually overlook some simple errors (I for one have been known to mess up some simple things, such as += and .= in PHP (which probably results from me learning like 5 languages at a time))
Feel free to post any revisions or elements this could use. I'm hoping to be able to make a thread where someone can look up a common problem and fi it by themselves.

New Topic/Question
Reply



MultiQuote










|