时间:2021-07-01 10:21:17 帮助过:25人阅读
这段代码将就看吧。需要学习基础知识。代码如下:
代码如下:
<?php
$mysqli = new MySQLi("localhost","root","123456","liuyan");
if(!$mysqli){
die($mysqli->error);
}
function showTable($mysqli,$table_name){
$sql = "select * from $table_name";
$res = $mysqli->query($sql);
//获取返回总行数和列数
echo "共有:".$res->num_rows."行;共有:".$res->field_count."列。";
//获取表头---从$res取出
echo "
{$field->name} | ";
---|
$value | ";
希望本文所述对大家的php程序设计有所帮助。