PEARのMDB2パッケージ使用例です。プレースホルダを用いています。
ちなみにDBパッケージはメンテナンスが終了しているため、使用が推奨されていません。


error_reporting(E_ALL);
if (error_reporting() > 6143) {

error_reporting(E_ALL & ~E_DEPRECATED);
}

require_once 'MDB2.php';

$dsn = array(
'phptype' => 'mysqli',
'username' => 'db_user',
'password' => 'db_password',
'hostspec' => 'localhost',
'database' => 'testDB',
);

$mdb2 =& MDB2::connect($dsn);

if (PEAR::isError($mdb2)) {

die($mdb2->getMessage());

}

///検索する名前を仮設定
$name = 'aaa';

$sql = "SELECT * FROM sampleTable WHERE name = ? ORDER BY id";

$stmt = $mdb2->prepare($sql, array('text'));
$res = $stmt->execute(array($name));

12 Comments

  1. gui hang di my says:

    … [Trackback]

    […] There you will find 21505 more Information on that Topic: dragon-ark.com/archives/549 […]

  2. microsoft exchange mail says:

    … [Trackback]

    […] Find More on to that Topic: dragon-ark.com/archives/549 […]

  3. it danışmanlığı says:

    … [Trackback]

    […] Find More here to that Topic: dragon-ark.com/archives/549 […]

  4. dell sunucu destek says:

    … [Trackback]

    […] Info on that Topic: dragon-ark.com/archives/549 […]

  5. Windshield advertising says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/549 […]

  6. instagram account audit says:

    … [Trackback]

    […] Find More on to that Topic: dragon-ark.com/archives/549 […]

  7. credit card shop says:

    … [Trackback]

    […] There you can find 59778 more Info on that Topic: dragon-ark.com/archives/549 […]

Leave a Reply