Call to undefined method PDO::execute()

后端 未结 1 480
时光取名叫无心
时光取名叫无心 2020-11-28 16:45

i\'m trying to code a page login but i was stopper at this error

pliz tell me the wrong thing here



        
相关标签:
1条回答
  • 2020-11-28 17:15

    ->execute() is for prepared statements. e.g.

    $stmt = $dbh->prepare('some query here');
    $stmt->execute();
    

    You're trying to execute a query directly on the main DB object. For PDO, that means

     $dbh->exec('query goes here');
    

    You really should look into prepared statements. You're vulnerable to SQL injection attacks as is, and since you're using PDO to begin with, it's basically unforgivable to NOT be writing safe queries.

    0 讨论(0)
提交回复
热议问题