时间:2021-07-01 10:21:17 帮助过:4人阅读
<?php //使用对象属性和方法来插入数据 header(‘Content-type:text/html;carset=utf8‘); $con=new mysqli(‘localhost‘,‘root‘,‘123456‘,‘t3‘,3306); $str=‘select * from tech‘; if($con->connect_error){ $con->connect_error(); } $con->set_charset(‘utf8‘); $result=$con->query($str); //fetch_assoc 返回数组 while($jieguo=$result->fetch_assoc()){ echo $jieguo[‘id‘].‘-------‘.$jieguo[‘name‘].‘---------‘.$jieguo[‘pwd‘].‘--------‘.‘<br>‘; } $con->close(); ?>
php和mysql交互 面向对象
标签:mysql htm roo html nec highlight type err rom