Please help me solve this problem:
if($_POST["keyword"]) {
$keyword       = $_POST["keyword"];
$keyword       = trim($keyword);
$keyword_array = explode(" ",$keyword);
$numberofwords = (integer)count($keyword_array);
require("server.php");
$link = open_koneksi();
$tbl_name      = "author";
$query         = "SELECT COUNT(*) as num FROM $tbl_name WHERE " ;
   for ($x = 0; $x<= $numberofwords; $x++) {
      $query .= "author LIKE '%$keyword_array[$x]%'";
      if ( $x <  $numberofwords ) {
         $query .= " AND ";
      }
   }
   echo("<SCRIPT>document.location.href='?p=result';</SCRIPT>");
}
If the code in the program segment is executed, there will be a warning as follows:
Notice: Undefined offset: 1 in C:\xampp\htdocs\bijang\result.php on line 111
Location of faults refer to this code:
$query .= "author LIKE '%$keyword_array[$x]%'";
How do I fix this?
 
     
     
     
    