-2

i had a problem in this line, because the error message tell me theres an undefined index:

$strSQL = " UPDATE place SET 
rating_value = '".$_POST["rating_value"]."' 
WHERE place_id = '".$_POST["place_id"]."'
";

pls help me if you have a solution. thanks

1 Answers1

-1

Do you check your variables before do the request like :

if( !empty($_POST["rating_value"]) && !empty($_POST["place_id"]) ) 
{
   // your request
} else {
  echo("error");
}
Aym2ric
  • 31
  • 1
  • 1
  • 6
  • no. the tutorial i follow is not checking the variable because the tutorial is still using under php 5. so i have to check the variable first? – renaldy kharisma Jan 11 '19 at 10:33
  • @renaldykharisma you **always** have to check the variables. A rule of thumb is to **never** trust user's inputs. They can enter silly things, on purpose of because... well they are users. – Cid Jan 14 '19 at 08:36