php+mysql+html展示效果





demo


  

"; var_dump($params); echo "
"; die; } function mysqlConnect(){ $config =[ 'host'=>'127.0.0.1', 'account'=>'root', 'password'=>'021104', 'dbname'=>'test', 'charset'=>'utf-8' ]; $connect = new mysqli($config['host'],$config['account'],$config['password'],$config['dbName']); if($connect->connect_error){ dd(‘数据库连接失败’); } $connect->set_charset($config['charset']); return $connect; } $id = isset($_GET['id'])?(int)$_GET['id']:0; if($id){ $sql = sprintf('SELECT * FROM '%s 'WHERE' id '=%d','t1',$id); $connect = mysqlConnect(); $res = $connect->query($sql); $result = [ ]; while($row = $res->fetch_object()) { $result[ ] = $row; } $row = reset($result); echo $row->name; } ?>

你可能感兴趣的:(php+mysql+html展示效果)