PHP使用PDO连接MYSQL

1 $serve = 'mysql:host=数据库地址;dbname=数据库名;charset=utf8';
2 $username = 数据库帐号;
3 $password = 数据库密码; 
4 $PDO = new PDO($serve,$username,$password);
5 $result = $PDO->query('insert into lyh_article (cid,comid,title,content,imagefile,source,datetime) values ('.$intocid.','.$comid.',"'.$title.'","'.$content.'","'.$imagefile.'","'.$source.'",'.$datetime.')');
6 $result->fetchAll(PDO::FETCH_ASSOC);

 

posted @ 2021-08-10 09:25  赵瑛  阅读(248)  评论(0编辑  收藏  举报

版权所有 © 2022 沅来是澧

如果有程序开发、网站建设等需求的请联系我,QQ:47419233