php mysql pdo连接数据库,没法操作数据库,无法读取数据。跪求解答。

WBOY
Release: 2016-06-13 12:38:50
Original
951 people have browsed it

php mysql pdo连接数据库,无法操作数据库,无法读取数据。跪求解答。。

try{
$votePDO = new PDO("mysql:host=127.0.0.1;dbname=legou", 'root', '2sinilei.',array( PDO::ATTR_PERSISTENT => true));
//$votePDO = new PDO();
//$pdoconn ->setAttribute(PDO::ATTR_PERSISTENT,true);
echo "success
";
}
catch(PDOException $e) {
echo $e->getMessage();
}

$result=$votePDO->query("select * from uz_types");
        var_dump($result);
$votePDO->query("insert into uz_types (TypeName)values('啊啊啊')");
echo "count=".$count."
";
//$result->setFetchMode(PDO::FETCH_ASSOC);
print_r($result);
if(empty($result))
{
echo "null";

}else
{
echo "have".count($result)."datas";
}
echo count($result);
foreach($result as $k=>$v)
{
echo $v['TypeName'];

};
?>



//这里是页面输出的结果

success
bool(false) count=
null1

//
php.ini 已经配置好了啊。
没有报错 说明链接上了吧 但是为什么会是这个输出呢?
求解求解啊~

pdo mysql
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template