Sometimes live server throws that error.It working fine in localhost while giving this error in live server.It happens sometimes not everytime.anyone please tell me the reason and solution.
here is the code where i am getting error…
$prices=array();
$price1=$property_type['price1'];
if (!empty($price1)) {
array_push($prices, $price1);
}
4
Answers
You have to use isset()
Try This
You should not assign to $price1 without knowing whether $property_type[‘price1’] is empty or nonempty. First, you should query whether $property_type[‘price1’] is empty or nonempty.
you can code:
This error could be triggered if
$property_type['price1']
is null or not set. Make sure it is set before trying to access it as an array element