本文实例讲述了PHP基于PDO扩展操作mysql数据库。分享给大家供大家参考,具体如下:
SELECT
//查单条
function get_sub_product()
{
$res_zz = $pdo->query("SELECT id FROM content WHERE is_publish = 0 LIMIT 1;");
$rep = $res_zz->fetch();
}
//查多条
function get_sub_product()
{
$dsn = 'mysql:host=localhost;dbname=bwdb';
$pdo = new PDO($dsn,
1