MySQL循环遍历执行查询SQL语句结果的方法
2015-08-19 20:20
891 查看
<?php $conn=mysql_connect("localhost","root","123456") or die(mysql_error()); $set=mysql_select_db("vt",$conn)or die(mysql_error()); mysql_query("SET NAMES `GBK`"); $sql="SELECT * FROM `user`"; $query=mysql_query($sql); ?> <table> <tr> <td>id</td> <td>username</td> </tr> <?php while($row=mysql_fetch_array($query)) { ?> <tr> <td><?php echo $row["id"]?></td> <td><?php echo $row["username"]?></td> </tr> <?php } ?> </table>
相关文章推荐
- mysql5.6 ERROR 1045 (28000): Access denied for user (using password: NO)
- mysqlconn-ocilib
- MySQL时间戳格式化函数FROM_UNIXTIME介绍
- mysql异常Lock wait timeout exceeded; try restarting transaction
- mysql---行与列互转
- Mysql5.7新特性
- ubuntu中mysql修改编码utf8
- mysql中的主从复制slave-skip-errors参数使用方法
- mysql information_schema
- MySQL
- MYSQL -- 查表字段描述SQL
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock
- Cent OS 6.4安装mysql
- MySQL添加用户、删除用户与授权
- Mysql 12 复制1
- mysql拒绝访问(Error 1044/1045)问题的解决
- MySQL执行SQL文件乱码
- MyBatis+MySQL 返回插入记录的主键ID
- mysql双主复制
- mysql 的 VARCHAR VARCHAR2