$result2 = $db->prepare('SELECT `lkey_member` FROM mxscript_slayer_licensekeys WHERE `lkey_key` = ?');
$result2->bindParam(1, $auth);
$result2->execute();
如何打印lkey_member
来自 result2 的值?
$result2 = $db->prepare('SELECT `lkey_member` FROM mxscript_slayer_licensekeys WHERE `lkey_key` = ?');
$result2->bindParam(1, $auth);
$result2->execute();
如何打印lkey_member
来自 result2 的值?
首先获取它,然后回显它。在这种情况下,您可以通过指定要获取的列的索引来使用PDO的fetchColumn函数(在这种情况下,您要检索的唯一列):
$lKeyMember = $result2->fetchColumn(0);
echo $lKeyMember;
从http://www.php.net/manual/en/pdostatement.fetch.php
/* Exercise PDOStatement::fetch styles */
//..print("PDO::FETCH_ASSOC: ");
//..print("Return next row as an array indexed by column name\n");
$result = $result2->fetch(PDO::FETCH_ASSOC);
print_r($result);
$result[0] 可能会有所帮助