Advertisement
colmulhall

Untitled

Apr 1st, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.         $username = 'root';
  3.         $password = '';
  4.         $database = 'test';
  5.         $host = 'localhost';
  6.  
  7.         // Create connection to the database
  8.         $con = mysqli_connect($host, $username, $password, $database);
  9.  
  10.         // Select database
  11.         mysqli_select_db($con, $database)or die("cannot select DB");
  12.  
  13.         // Check if database is found
  14.         $db_found = mysqli_select_db($con, $database)or die("cannot select DB");
  15.         if ($db_found)
  16.         {
  17.                 // Form a query to insert into the database
  18.         $sql = "INSERT INTO event_list (title, description, location)
  19.                        VALUES
  20.                        ('title', 'desc', 'phoenix park')";
  21.  
  22.                 // Run insert the query
  23.                 mysqli_query($con, $sql);
  24.         }
  25.         else
  26.                 print "Database Not Found";
  27.  
  28.         mysqli_close($con);
  29.     }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement