php7設定mysqli和使用mysqli連接mysql
#推薦(免費):PHP7
extension=php_mysqli.dll
; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:extension_dir = "ext"
<?php$con = new mysqli('localhost','root','','xiaohua');if(!$con) die("connect error:".mysqli_connect_error());else echo "success connect mysql\n";$sql = "select distinct class_id from xiaohua_user";$rs = $con->query($sql);$c = array();while($r = $rs->fetch_row()){ array_push($c,substr($r[0],0,4)); }$c = array_unique($c);$i=0;$zy = array();foreach($c as $row){ array_push($zy,$row); } print_r($zy);$con->close(); ?
以上是學習php7配置mysqli和使用mysqli連接mysql的詳細內容。更多資訊請關注PHP中文網其他相關文章!