I have been unsuccessful in running prepared statements in PDO. I would like to ask some experts to give me some advice.
W
W 2017-11-21 23:25:40
0
1
1010

<?php

$servername = "localhost";

$username = "root";

$password = "";

$dbname = "myDBPDO";


try{

$conn = new PDO("mysqli:host=$servername;dbname=$dbname; ",$username,$password);


## //Set the PDO error mode to exception

$conn->serAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


//Preprocess SQL and bind parameters

$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);


                            //                                                                                                       out’s               out’s           ’‐ ‐     ‐ ‐ ‐ ‐‐ ‐ ‐ ‐ ‐ ‐                                                                                 -            $email = "jhon@example.com";

$stmt->execute();

## $firstname = "Mary";

$lastname = "Moe";

$email = "mary@example.com";


$stmt->execute();

      $firstname = "Julie";

        $lastname = "Dooley";

        $email = "julie@example.com";


        $stmt->execute();

##                                                       $stmt->execute();

##                                                                       using  --                     $stmt->execute(); ";


## }catch(PDOException $e){

echo "Error:<br> ". $e->getMessage();


}

## $conn=null;

 

?> ;

W
W

愿能多结交志同道合的基友!哈哈哈。。。。。

reply all(1)
电动小老虎

Post the error code, otherwise you won’t be able to read it. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template