www.ctrt.net > php读取mysql,如何以表格显示数据?

php读取mysql,如何以表格显示数据?

请运行你的PHP代码后再截图,直接打开直接只会显示HTML代码的效果,不执行PHP代码

index.php id

$con=mysql_connect('localhost','root','');//数据库信息mysql_select_db('shop');//数据库名mysql_query("set names utf8");//设置字符集编码$sql="select goods_name,goods_number,shop_price from goods";//查询语句$res=mysql_query($sql);...

$mysqli = new mysqli ( DB_HOST , DB_USER , DB_PASSWORD , DB_NAME ); /* check connection */ if ( mysqli_connect_errno ()) { printf ( "Connect failed: %s\n" , mysqli_connect_error ()); exit(); } $limit = 10; $query = "SELECT * FR...

$result = mysql_query('select * from mytable limit 0, 20');$i = 0;while ($rs = mysql_fetch_array($result)){ echo $rs['myfield'].' '; $i++; if ($i == 10) { echo ''; }}

$conn = mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('abc'); mysql_query('set names utf8'); //上面这三句你根据自己的情况去写吧 $sql = 'select * from member'; $query = mysql_query($sql,$conn); if($...

试编写代码如下:

table标签加句border="一"试

用就可以了啊,然后用PHP的逐条输出数据语句相结合,你图太小,根本看不清,不过道理就是这么个道理的

网站地图

All rights reserved Powered by www.ctrt.net

copyright ©right 2010-2021。
www.ctrt.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com