Tuesday, March 8, 2011

PHP වරදින තැන්...-1

මේ වගෙ post එකක් Unicode ගහන එක එපා වෙන වැඩක්....සොරි හොඳෙ .....අමාරුයි කියලා හිතෙන English ඉස්සරහින් සින්හලෙන් ලියල ඇති අමරුවෙන් හරි කියවගෙන යන්නකො.......
If you have E_ALL turned on in your php.ini file, you will see the error messages very clearly.
F:\xampp\php\ php.ini
php.ini is the configuration file
If you are a programmer it is normal thing to occur errors .If you are a novice(ආධුනික) to programming or PHP it may be large quantity. But after get the experience it may decreasing rapidly(වෙගයෙන් අඩුවෙයි).
Don’t think about them ….these are the main errors …care about and avoid(මග හරවා ගන්න) your main errors….
Mainly the errors are occurred from using single quotation marks (‘) and double quotation marks (“) which we did to highlight an important point.
PHP can easily understand the following statement:
Think about this php code

echo “I’m a boy.”;

echo ‘I’m a boy.’;


Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 2

The problem is the apostrophe in the word I ’ m . PHP thinks it matches the single quotation mark that started the string of text, making the text just I . The rest of the statement, m a boy. , is unintelligible gibberish (වැඩක් නැති පල් හැල්ලක්) to PHP.

All PHP session information is at the top of the page, before any HTML code is used. This is
very important! If there is even a leading space before the PHP code at the top of the page, you
will receive an error such as:
හැබයි warning ටික @ sign එක දාලා මග හරව ගන්න පුලුවන්.
"@session_start(); " කියලා දාලා….

Warning: session_start(): Cannot send session cache limiter - headers already sent(output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php:1) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\moviesite.php on line 2

පට්ට නිදි මතක් ආවා ....මම නිද ගන්න යනො