简体   繁体   中英

What is mysql_result in PDO?

I have been looking all over for what i thought was very simple answer! So very simple question, what would

$result = mysql_result(mysql_query("SELECT name FROM cars WHERE id = 3"), 0);
echo $result;

be In PDO?

Thanks for any help!

$result = $pdo->query('SELECT name FROM cars WHERE id = 3')->fetchColumn();

参见PDO::queryPDOStatement::fetchColumn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM