SORU
24 Temmuz 2009, Cuma


BindParam ve bindValue arasındaki fark nedir?

PDOStatement::bindParam() PDOStatement::bindValue() arasındaki fark nedir?

CEVAP
22 ŞUBAT 2011, Salı


the manual entry for PDOStatement::bindParam:

[bindParam]* *6, Aksine değişken bir referans olarak bağlı ve tek PDOStatement::execute() denilen bir zamanda değerlendirilecektir.

Bu yüzden, örneğin:

$sex = 'male';
$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');
$s->bindParam(':sex', $sex); // use bindParam to bind the variable
$sex = 'female';
$s->execute(); // executed with WHERE sex = 'female'

ya

$sex = 'male';
$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');
$s->bindValue(':sex', $sex); // use bindValue to bind the variable's value
$sex = 'female';
$s->execute(); // executed with WHERE sex = 'male'

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Elliot Davin

    Elliot Davin

    28 Kasım 2008
  • Paste Magazine

    Paste Magazi

    28 AĞUSTOS 2008
  • TastyTuts | Creative video tutorials by Gareth David

    TastyTuts |

    6 Temmuz 2011