title: Fatal error: Uncaught Error: Call to undefined function
body: <p>I am trying to call a custom made function (not mysql_* as in other questions suggested) from the index page. The index page is calling three custom functions. The first two are working correctly but the third function is throwing and error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined function display_index1() in F:\Apache24\htdocs\Site1\index.php:45 Stack trace: #0 {main} thrown in F:\Apache24\htdocs\Site1\index.php on line 45</p>
  </blockquote>
  
  <p>This is my index page which is calling the function:</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
      &lt;?php 
      include("includes/connect.php");
      include("includes/functions.php"); 
      ?&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Ecommerce Website&lt;/title&gt;
          &lt;link rel="stylesheet" type="text/css" href="styles/style.css"&gt;
          &lt;script src="js/style.js"&gt;&lt;/script&gt;
      &lt;body&gt;
          &lt;div class="container-fluid"&gt;
              &lt;header&gt;
                  &lt;div class="form"&gt;
                      &lt;form method="get" target="" name="searchbar_form"&gt;
                          &lt;input type="text" name="searchbar" id="searchbar"&gt;
                          &lt;input type="submit" id="search_button" value="Search"&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/header&gt;
              &lt;div class="menubar"&gt;
  
                      &lt;div class="dropdown"&gt;
                          &lt;button onclick="dropdownToggle()" class="dropdown-button"&gt;Shop By Category&lt;/button&gt;
  
                              &lt;ul class="dropdown-content" id="dropdownContent"&gt;
                                  Categories
                                  &lt;?php getcats(); ?&gt;
                                  Brands
                                  &lt;?php getbrands(); ?&gt;
                              &lt;/ul&gt;
  
                      &lt;/div&gt;
                  &lt;div class="menubar-div"&gt;
                      &lt;ul class="menu-items"&gt;
                          &lt;?php getcats(); ?&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
                  &lt;div class="cart"&gt;
                      &lt;a href="#"&gt;Cart&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="content"&gt;
                  &lt;div class="index_product_row"&gt;
                      &lt;?php display_index1(); ?&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="footer"&gt;
                  This is footer
          &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>This is the functions.php file which has the three called functions:</p>
  
  <pre><code>&lt;?php 
  
      function getcats(){
          global $con;
  
          $get_cats="select * from categories";
          $run_cats=mysqli_query($con, $get_cats);
  
          while($row_cats=mysqli_fetch_array($run_cats)){
              $cat_id = $row_cats['cat_id'];
              $cat_title = $row_cats['cat_title'];
  
              echo "&lt;li&gt;&lt;a href='#'&gt;$cat_title&lt;/a&gt;&lt;/li&gt;";
          }
      }
  
  
  
      function getbrands(){
          global $con;
  
          $get_brands="select * from brands";
          $run_brands=mysqli_query($con, $get_brands);
  
          while($row_brands=mysqli_fetch_array($run_brands)){
              $brand_id = $row_brands['brand_id'];
              $brand_title = $row_brands['brand_title'];
  
              echo "&lt;li&gt;&lt;a href='#'&gt;$brand_title&lt;/a&gt;&lt;/li&gt;";
          }
      }
  
  
      function display_index1(){
          global $con;
  
          $display_query = "select(product_image, product_title) from products where product_cat='1'";
          $display_result = mysqli_query($con, $display_query);
  
          while($result_rows = mysqli_fetch_array($display_result)){
              $product_image = $result_rows['product_image'];
              $product_title = $result_rows['product_title'];
  
              echo "&lt;img src='/admin/product_images/".$product_image."' width='200' height='200' alt='".$product_title."'/&gt;";
              echo "&lt;span id='index_product_title'&gt;".$product_title."&lt;/span&gt;";
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>The first two functions are returning data successfully. Calling the third is returning the error.</p>