PDO kullanmak için en iyi yolu nedir tablolar hazırlanır nedir?

0 Cevap php

When using prepared statements in PDO should I "build" a prepared statement for every db call or can I use one statement for all calls? example:

 class DB{
    ...
    function query($sqlStatementString,$data){
        $this->sth->prepare($sqlStatementString);
        $this->sth->execute($data);
    }
    ...
}

VEYA

class User{
    ...
    function doSomething(){
        $sthForDoSomething->prepare(...);
        $sthForDoSomething->execute(...);
    }
    ...
    function jump(){
        $sthForJump->prepare(...);
        $sthForJump->execute(...);
    }
}

Are there memory/speed implications of using one method over the other? thanks!

0 Cevap