php里查询mysql数据库报错。代码如下
mysql查询数据库的时候报错了,不知道为什么,代码如下:<?phpinclude_once('ConnectSQL.php');$mSearch=$_POST['sea...
mysql查询数据库的时候报错了,不知道为什么,代码如下:
<?php include_once('ConnectSQL.php'); $mSearch=$_POST['search']; $perPageNum = 8; $sql="Select * from MovieInfo WHERE MovieName LIKE '%'.$mSearch.'%'"; echo $sql; $TotalNum=mysqli_num_rows(mysqli_query($link,$sql)); echo $TotalNum; $TotalPage=ceil($TotalNum/$perPageNum); if(isset($_GET['Page'])) { $PageNum=intval($_GET['Page']); } else { $PageNum=1; } $StartPage=($PageNum - 1) * $perPageNum; $divPage=mysqli_query($link,"Select * from MovieInfo WHERE MovieName LIKE '%'.$mSearch.'%'Limit $StartPage,$perPageNum"); while($row=mysqli_fetch_array($divPage)) { echo '<div class="grid_3 project-item"> <figure class="project-img"> <img src="'.$row['MoviePoster'].'" alt="" /> <div class="overlay"></div> <div class="mask"> <a class="icon-image" href="'.$row['MoviePoster'].'" rel="prettyphoto[gallery]" title="影视分类"><i class="icon-search"></i> </a> </div> </figure> <div class="project-desc"> <h3><a href="MovieDetials.php?Name='.$row['MovieName'].'">'.$row['MovieName'].'</a><br/> 豆瓣评分:'.$row['MovieHot'].'</h3> </div></div>'; } ?>
报的错误如图:
想echo看看sql语句有没错,结果运行后没有出现sql的语句 展开
<?php include_once('ConnectSQL.php'); $mSearch=$_POST['search']; $perPageNum = 8; $sql="Select * from MovieInfo WHERE MovieName LIKE '%'.$mSearch.'%'"; echo $sql; $TotalNum=mysqli_num_rows(mysqli_query($link,$sql)); echo $TotalNum; $TotalPage=ceil($TotalNum/$perPageNum); if(isset($_GET['Page'])) { $PageNum=intval($_GET['Page']); } else { $PageNum=1; } $StartPage=($PageNum - 1) * $perPageNum; $divPage=mysqli_query($link,"Select * from MovieInfo WHERE MovieName LIKE '%'.$mSearch.'%'Limit $StartPage,$perPageNum"); while($row=mysqli_fetch_array($divPage)) { echo '<div class="grid_3 project-item"> <figure class="project-img"> <img src="'.$row['MoviePoster'].'" alt="" /> <div class="overlay"></div> <div class="mask"> <a class="icon-image" href="'.$row['MoviePoster'].'" rel="prettyphoto[gallery]" title="影视分类"><i class="icon-search"></i> </a> </div> </figure> <div class="project-desc"> <h3><a href="MovieDetials.php?Name='.$row['MovieName'].'">'.$row['MovieName'].'</a><br/> 豆瓣评分:'.$row['MovieHot'].'</h3> </div></div>'; } ?>
报的错误如图:
想echo看看sql语句有没错,结果运行后没有出现sql的语句 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询