使用php和mysql连接数据库,没有报错,但运行后数据表为空
conn.php:<?php$conn=mysql_connect("localhost","root","");mysql_query("setnames'gb2312...
conn.php:<?php$conn=mysql_connect("localhost","root","");mysql_query("set names 'gb2312'");mysql_select_db("guestbook",$conn);?>example3.php:<?require("conn.php");$conn=mysql_connect("localhost","root","");mysql_query("set names 'gb2312'");mysql_select_db("guestbook",$conn);$result=mysql_query("Select * from lyb",$conn);?><table border="1" width="95%"> <tr bgcolor="#e0e0e0"> <th>标题</th> <th width="100">内容</th> <th width="60">作者</th> <th>email</th> <th width="80">来自</th></tr> <? while($row=mysql_fetch_assoc($result)){ ?> <tr><td ><?= @$row['title']?></td> <td><?= @$row['content']?></td> <td><?= @$row['author']?></td> <td><?= @$row['email']?></td> <td><?= @$row['IP']?></td></tr> <? } ?></table>
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询