Advertisement
Guest User

Untitled

a guest
Feb 9th, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2. $con=mysql_connect("localhost","root","");
  3. mysql_select_db("mainm24",$con) or die(mysql_error($con));
  4. error_reporting(E_ALL ^ E_NOTICE);
  5. session_start();
  6.  
  7.  
  8. if($_POST){
  9. $bd = $_POST['bookdate'];
  10. $fn = $_POST['fname'];
  11. $ln = $_POST['lname'];
  12. $em = $_POST['email'];
  13.  
  14. $s1="INSERT INTO bookings (first_name, last_name, email, booking_date)VALUES('".$fn."', '".$ln."','".$em."' ,'".$bd."')";
  15. //$s2="select * from bookings where booking_date = "
  16. mysql_query($s1) or die (mysql_error($con));
  17. }
  18. ?>
  19.  
  20. <?php
  21. $servername = "localhost";
  22. $username = "id56251_root";
  23. $password = "*****";
  24. $database = "id56251_mainm24";
  25.  
  26.  
  27. // Create connection
  28. $conn = new mysqli($servername, $username, $password, $database);
  29.  
  30. // Check connection
  31. if ($conn->connect_error) {
  32. die("Connection failed: " . $conn->connect_error);
  33. }
  34. echo "Connected successfully";
  35.  
  36.  
  37. if($_POST){
  38. $bd = $_POST['bookdate'];
  39. $fn = $_POST['fname'];
  40. $ln = $_POST['lname'];
  41. $em = $_POST['email'];
  42.  
  43. $s1="INSERT INTO bookings (first_name, last_name, email, booking_date)VALUES('".$fn."', '".$ln."','".$em."' ,'".$bd."')";
  44. //$s2="select * from bookings where booking_date = "
  45. mysqli_query($s1) or die (mysqli_error($conn));
  46. }
  47. ?>
  48.  
  49. // Check connection
  50. if ($conn->connect_error) {
  51. die("Connection failed: " . $conn->connect_error);
  52. }
  53. echo "Connected successfully";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement