我这个代码用了mysqli了为什么还是提示这个呢?
还提示图片里的内容哪里写的不对吗?<?php$con=mysqli_connect("localhost","root","","t1");if(mysqli_conne...
还提示图片里的内容 哪里写的不对吗?
<?php
$con =mysqli_connect("localhost","root","","t1");
if (mysqli_connect_errno($con))
{
die('Could not connect: ' . mysql_error());
}
mysqli_query($sql,$con);
$sql='select*from stu';
$rs=mysqli_query($sql,$con);
$list=array();
while($row=mysql_fetch_assoc($rs)){
$list[]=$row;
}
echo '$sql'
?>
<html>
<head>
<style type="text/css">
li{list-style: none;display: block;float: left;}
ul{both:clear;}
</style>
</head>
<body>
<div>
<ul>
<li>学号</li>
<li>姓名</li>
<li>年龄</li>
</ul>
<ul>
<?php
foreach($list as $v){
echo '<li>'.$v['id'].'</li>';
echo '<li>'.$v['name'],'</li>';
echo '<li>'.$v['num'].'</li>';
echo '<li><a href="1.php?id='.$v['id'].'">编辑</a></li>';
}
?>
</ul>
</div>
</form>
</body>
</html> 展开
<?php
$con =mysqli_connect("localhost","root","","t1");
if (mysqli_connect_errno($con))
{
die('Could not connect: ' . mysql_error());
}
mysqli_query($sql,$con);
$sql='select*from stu';
$rs=mysqli_query($sql,$con);
$list=array();
while($row=mysql_fetch_assoc($rs)){
$list[]=$row;
}
echo '$sql'
?>
<html>
<head>
<style type="text/css">
li{list-style: none;display: block;float: left;}
ul{both:clear;}
</style>
</head>
<body>
<div>
<ul>
<li>学号</li>
<li>姓名</li>
<li>年龄</li>
</ul>
<ul>
<?php
foreach($list as $v){
echo '<li>'.$v['id'].'</li>';
echo '<li>'.$v['name'],'</li>';
echo '<li>'.$v['num'].'</li>';
echo '<li><a href="1.php?id='.$v['id'].'">编辑</a></li>';
}
?>
</ul>
</div>
</form>
</body>
</html> 展开
2个回答
展开全部
没有哪里不对,你前面加个@符合就可以了,或者这样写也行,网上大神说的is_resource($link)||$link=mysqli_connect($server_name,$server_usr,$server_pwd,$server_db) or die("不能连接数据库 : ".mysqli_connect_error());
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询