title: PHP code not working,not connecting to mysql database
body: <p>I'm trying to get simple form data added to mysql database via php.</p>
  
  <p>This is my php code..
      
  
  <pre><code>$dbc = mysqli_connect('localhost','root','sahunihal123321','aliendatabase')
  or die('Error connecting to MySQL server.');
  
  $query="INSERT INTO aliens_abduction (first_name,last_name,when_it_happened,how_long, " .
  "how_many,alien_description,what_they_did,fang_spotted,other,email)" .
  "VALUES ('$first_name','$last_name','$when_it_happened','$how_long','$how_many', " .
  "'$alien_description','$what_they_did','$fang_spotted','$other','$email')";
  
  $result=mysqli_query($dbc,$query)
  or die('Error querying database.');
  mysqli_close($dbc);
  
  
    echo 'Thanks for submitting the form.&lt;br /&gt;';
    echo 'You were abducted ' . $when_it_happened;
    echo ' and were gone for ' . $how_long . '&lt;br /&gt;';
    echo 'Number of aliens: ' . $how_many . '&lt;br /&gt;';
    echo 'Describe them: ' . $alien_description . '&lt;br /&gt;';
    echo 'The aliens did this: ' . $what_they_did . '&lt;br /&gt;';
    echo 'Was Fang there? ' . $fang_spotted . '&lt;br /&gt;';
    echo 'Other comments: ' . $other . '&lt;br /&gt;';
    echo 'Your email address is ' . $email;
  
  
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Nothing is being displayed.</p>
  
  <p>So ,Something going wrong in the connect stage,
  Im working on a local system not a server , and no problem with the form </p>
  
  <p>I go to access my mysql database ,this is what i see </p>
  
  <pre><code>nsnihalsahu@nsnihalsahu-home:~$ mysql -u root -p
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 38
  Server version: 5.5.34-0ubuntu0.13.10.1 (Ubuntu)
  
  Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  
  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective
  owners.
  
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  
  mysql&gt; SHOW DATABASES
      -&gt; ;
  +--------------------+
  | Database           |
  +--------------------+
  | information_schema |
  | aliendatabase      |
  | mysql              |
  | performance_schema |
  | test               |
  +--------------------+
  5 rows in set (0.00 sec)
  
  mysql&gt; USE aliendatabase
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  
  Database changed
  mysql&gt; SHOW TABLES;
  +-------------------------+
  | Tables_in_aliendatabase |
  +-------------------------+
  | aliens_abduction        |
  +-------------------------+
  1 row in set (0.00 sec)
  
  mysql&gt; SELECT * FROM aliens_abduction;
  Empty set (0.00 sec)
  </code></pre>
  
  <p>How do I resolve this?</p>