function Update_v2($mysqli,$table_name, $form_data, $where_clause=){   

  //global $mysqli;

  // check for optional where clause

  $whereSQL = ;

  if(!empty($where_clause)){

    // check to see if the where keyword exists

    if(substr(strtoupper(trim($where_clause)), 0, 5) != WHERE){

      // not found, add key word

      $whereSQL =  WHERE .$where_clause;

    } else {

      $whereSQL =  .trim($where_clause);

    }

  }

  // start the actual SQL statement

  $sql = UPDATE `.$table_name.` SET ;



  // loop and build the column /

  $sets = array();

  foreach($form_data as $column => $value){

    $sets[] = `.$column.` = .$value.;

  }

  $sql .= implode(, , $sets);



  // append the where statement

  $sql .= $whereSQL;

       

  $dt[sql]=$sql.;;

  // run and return the query result

  // return mysqli_query($mysqli,$sql);

  if(mysqli_query($mysqli,$sql)) {

    $dt[result]=Success;

  } else {

    $dt[result]=Error;    

  }  

  return json_encode($dt);

}