Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4.         // Variables
  5.            
  6.         $db_host = 'localhost';
  7.         $db_user = 'root';
  8.         $db_pass = 'root';
  9.         $db_name = 'pt_db';
  10.  
  11.         $Projectname = $_POST['projectname'];
  12.         $Starttime    = $_POST['starttime'];    
  13.         $Endtime    = $_POST['endtime'];    
  14.        
  15.  
  16.             $con = mysql_connect($db_host, $db_user, $db_pass);
  17.             if (!$con)
  18.               {
  19.               die('Could not connect: ' . mysql_error());
  20.               }
  21.            
  22.             mysql_select_db($db_name, $con);
  23.  
  24.             $sql='INSERT INTO Projects (projectname, starttime, endtime)
  25.             VALUES ("$Projectname", "$Starttime", "$Endtime")';
  26.  
  27.             if (!mysql_query($sql,$con))
  28.               {
  29.               die('<p class="ui-state-error ui-corner-all">Error: ' . mysql_errno() . ". " . mysql_error() . '</p>');
  30.               }
  31.             echo "<p class='ui-state-highlight'>1 record added</p>";
  32.  
  33.             mysql_close($con)
  34.  
  35.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement