title: How do you define a variable for mysqli_connect?
body: <p>I am following an example on W3C for a simple database connection using PHP and MYSQL however it is coming up with two errors which I don't understand due to on W3C that is how they do it and theirs do not error. </p>
  
  <p><strong>Error 1</strong></p>
  
  <p>Notice: Undefined variable: mysqli_connect in C:\xampp\htdocs\ShoutIt\database.php on line 3</p>
  
  <p><strong>Error 2</strong></p>
  
  <p>Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\ShoutIt\database.php:3 Stack trace: #0 C:\xampp\htdocs\ShoutIt\index.php(1): include() #1 {main} thrown in C:\xampp\htdocs\ShoutIt\database.php on line 3</p>
  
  <p><strong>index.php file</strong></p>
  
  <pre><code>&lt;?php include 'database.php'; ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;Shout It !&lt;/title&gt;
          &lt;link rel="stylesheet" href="CSS/style.css" type="text/css"/&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="container"&gt;
              &lt;header&gt;
                  &lt;h1&gt;SHOUT IT! Shoutbox&lt;/h1&gt;
              &lt;/header&gt;
              &lt;div id="shouts"&gt;
                  &lt;ul&gt;
                      &lt;li class="shout"&gt;&lt;span&gt;10:15PM - &lt;/span&gt;Brad : Hey What Are you guys up to.&lt;/li&gt;
                      &lt;li class="shout"&gt;&lt;span&gt;10:15PM - &lt;/span&gt;Brad : Hey What Are you guys up to.&lt;/li&gt;
                      &lt;li class="shout"&gt;&lt;span&gt;10:15PM - &lt;/span&gt;Brad : Hey What Are you guys up to.&lt;/li&gt;
                      &lt;li class="shout"&gt;&lt;span&gt;10:15PM - &lt;/span&gt;Brad : Hey What Are you guys up to.&lt;/li&gt;
                      &lt;li class="shout"&gt;&lt;span&gt;10:15PM - &lt;/span&gt;Brad : Hey What Are you guys up to.&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
              &lt;div id="input"&gt;
                  &lt;form method="post" action="process.php"&gt;
                      &lt;input type="text" name="user" placeholder="Enter Name" /&gt;
                      &lt;input type="text" name="message" placeholder="Message" /&gt;
                      &lt;br/&gt;
                      &lt;input class="shout-btn" type="submit" name="submit"value="Shout It Out !" /&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>database.php file</strong></p>
  
  <pre><code>&gt; &lt;?php //Connect to MySQL $con =
  &gt; $mysqli_connect("localhost","root","Passwordaaa","shoutit");
  &gt; 
  &gt; //Test Connection if(mysqli_connect_errno()){     echo 'Failed to connect
  &gt; to MySQL: '.mysqli_connect_error(); }
  </code></pre>