php - Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in -


im trying call stored procedure php , mysql , getting above error message? got ideas of i'm doing wrong?

try{    $conn = new pdo('mysql:host=localhost;dbname=holidaybookingapp', '', ''); } catch (pdoexception $exception)  {    echo "oh no, there problem" . $exception->getmessage(); }      $startdate="2017-05-23";     $enddate="2017-05-23";     $empid= "2";      $sql='call spaddnewholiday(:employeeid,:startdate,:enddate)';     $stmt = $conn->prepare($sql);      $stmt = $conn->prepare("call spaddnewholoiday(?,?,?)");      $stmt->bindparam('employeeid',$empid, pdo::param_str);     $stmt->bindparam('startdate1',$startdate, pdo::param_str);     $stmt->bindparam('enddate1',$enddate, pdo::param_str);     //$array=array($empid, $startdate,$enddate);      $stmt->execute(); // call stored procedure 

remove second prepare(), , placeholders have match same name

$startdate="2017-05-23"; $enddate="2017-05-23"; $empid= "2";  $sql='call spaddnewholiday(:employeeid,:startdate,:enddate)'; $stmt = $conn->prepare($sql);  $stmt->bindparam('employeeid',$empid, pdo::param_str); $stmt->bindparam('startdate',$startdate, pdo::param_str); $stmt->bindparam('enddate',$enddate, pdo::param_str);  $stmt->execute(); // call stored procedure 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -