Topic: PHP

PHP Warning: Cannot modify header information – headers already sent

PHP Warning: Cannot modify header information – headers already sent – It is caused due to Functions that send/modify HTTP headers must be invoked before any output is made. Otherwise the call fails: Warning: Cannot modify header information – headers already sent (output started at script:Line Number) Reason: HTTP HEADERS are very sensitive. The function […]

mysql_fetch_assoc() expects parameter 1 to be resource, provided boolean: Reason and Solution

Mysql_fetch_assoc() expects parameter 1 to be resource but boolean is provided can be caused due to various reason. We have to analyse the code and hand the issue accordingly. NOTE: The mysql_ functions are deprecated and have been removed in php version 7. So we are going to use mysqli_function Reason: If we are using […]

Fifteen easy solutions to identify, handle and parse PHP Syntax Errors efficiently

One of the annoying problem most web developers encounter is PHP Syntax Errors. What are PHP Syntax Errors? PHP syntax errors are the errors that is caused due to implementation of wrong syntax in the PHP Script. PHP is a server side scripting language. Therefore, we have to careful while using this scripting language in […]

Solution to PHP Notice: undefined index or Undefined offset

One of the PHP Notice that we can notice while running PHP Script is Undefined Index or Undefined Offset. Why PHP Shows the notice – Undefined index or Undefined offset? Index or offset is associated with array in PHP. If an array variable does not contain key value or the array value is null or […]

What is Notice: Undefined variable in PHP and Solution?

The biggest challenge in front of web developer is to run PHP scripts without any errors and warnings. PHP: Notice undefined variable is the one of the warning, we encounter. Why warning or notice, ‘Undefined variable’ rises? As the warning or notice says, undefined variable, the variable is not defined and we are trying to […]

Simple tricks to prevent SQL Injection using PHP

SQL Injection is one of the biggest threat most website developer are worried for. There are various solutions available. But there are no 100% sure shot solution to prevent SQL Injection. What is SQL Injection? A way to inject SQL queries in to the server. This injection can be done through input fields such as […]

PHP Print all values of an Array

PHP array is efficient way to store large number of data in to a variable name. Situation may come, where we may want to print all the values of array. Print all values of an Array To print an array, we must have to know the total number of values in the array. If you […]

PHP Concatenation operator

PHP concatenation operator is another powerful operator that helps us to provide more meaningful content to user. The symbol of concatenation operator is . (dot) Why Concatenation Operator (.) is used? In PHP, while performing task, we may get various datatype values such as integer value, string value. To provide user more meaningful content, we […]

PHP Arrays

In PHP, Arrays are beneficial to handle large number of data with index. Benefit of index, we can retrieve back the information. Why do we need Array? Array are beneficial to keep large number of data in single variable. You would wonder and astonish to know, SQL, Classes, Online data fetching(JSON) etc. are strictly result […]

PHP While loops

While loop in PHP, is another efficient way to execute task in loop. While loop can also be considered to alternative to for loop. While Loop: While loop is used to execute task in loop. While loop syntax: initial value while (condition){ // execute required task // what should it do at the end of […]