Advertisement
colmulhall

Untitled

Apr 1st, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 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.                 // Insert into the database
  18.                 mysqli_select_db($con, $database)or die("cannot select DB");
  19.                
  20.                 $sql = "INSERT INTO event_list (title, description, location)
  21.                        VALUES
  22.                        ('title', 'desc', 'phoenix park')";
  23.  
  24.                 // Run insert the query
  25.                 mysqli_query($con, $sql);
  26.         }
  27.         else
  28.                 print "Database Not Found";
  29.  
  30.         mysqli_close($con);
  31.     }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement