0

Below is my code..
$stmt->execute($params) is not getting executed

        $name = $_REQUEST['name2'];
        $surname = $_REQUEST['surname2'];
        $add = $_REQUEST['add2'];
        $pdo = new PDO( "mysql:host = localhost;dbname = employee", "xxx", "");
        $stmt = $pdo->prepare( 'INSERT INTO test_differ VALUES( :name2 , :surname2 , :add2 )' );
        $params = array( ':name2' => $name, ':surname2' => $surname, ':add2' => $add );
        if ( !($stmt->execute($params))) {
            echo "error in execution";
        }

        $pdo = null;

Edited by code_rum

2
Contributors
4
Replies
17
Views
4 Years
Discussion Span
Last Post by code_rum
1

I debugged it
I was missing space between values and opening bracket
changed VALUES( :name2 , :surname2 , :add2 ) to VALUES ( :name2 , :surname2 , :add2 )
and solved :-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.