Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

PDO Insert Query


  $stmt = $conn->prepare("INSERT INTO MyGuests (firstname, lastname, email)
  VALUES (:firstname, :lastname, :email)");
  $stmt->bindParam(':firstname', $firstname);
  $stmt->bindParam(':lastname', $lastname);
  $stmt->bindParam(':email', $email);

  // insert a row
  $firstname = "John";
  $lastname = "Doe";
  $email = "john@example.com";
  $stmt->execute();
Source by www.phptutorial.net #
 
PREVIOUS NEXT
Tagged: #PDO #Insert #Query
ADD COMMENT
Topic
Name
9+8 =