解决错误“在第77行的C\ wamp \ -www + \\ _admin-rights-display.php除以零”。 和amp;安培; “警告mysql_fetch_array期望参数1是资源,布尔值在...把出
it1352
帮助1人
问题说明
我创建了一个页面,用户在文本框中键入关键字并单击按钮后搜索记录。但是我收到一条错误,说在C中分为零:第78行的'\ wamp \ www。\\ _admin-rights-display.php和警告:mysql_fetch_array()期望参数1是资源,布尔值在第93行的C:\ wamp \ #www.admin-rights-display.php。我不知道该怎么办。这是我的代码:
I have created a page where the user searches for records after typing a keyword in a textbox and clicks on a button. However I am getting an error saying "Division by zero in C:\wamp\www\admin-rights-display.php on line 77" and "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\admin-rights-display.php on line 93". I dont know what to do. Here are my codes:
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<!doctype html>
<!--[if lt IE 7]> <html lang="en"> <![endif]-->
<!--[if IE 7]> <html lang="en"> <![endif]-->
<!--[if IE 8]> <html lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Community Night Cycling 2014 Singapore</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable = no">
<meta name="谷歌bot" content="index, follow" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" href="style/general.css" />
<link rel="stylesheet" href="style/framework.css" />
<link rel="stylesheet" href="style/site.css" />
<script src="js/modernizr-2.0.6.min.js" type="text/javascript"></script>
</head>
<body class="contact">
<div class="mother">
<header class="mast-head stack-fixed clearfix">
<article class="logo">
<a href="index.html"></a>
</article>
<nav class="main-nav">
<ul>
<li class="first">
<a href="home.html">Home</a>
</li>
<li>
<a href="register.html">Registration</a>
</li>
<li>
<a class="selected" href="admin.html">Administrator Page</a>
</li>
<li class="last">
<a href="stats.html">Statistics</a>
</li>
</ul>
</nav><!-- end .main-nav -->
</header>
<article class="main" role="main">
<section class="stack-fixed clearfix entry-text">
<div class="top-mast contact-top-mast">
</div>
<div class="row">
<div class="slat-8">
<div id="fields">
$Search = $_POST['Search'];
if ($Search == "ALL")
{
$result = mysql_query("SELECT Name, Gender, Age, Email, Occupation, NRIC, Address, ZipCode FROM members ",$connection);
}
else
{
$result = mysql_query("SELECT Name, Gender, Age, Email, Occupation, NRIC, Address, ZipCode FROM members WHERE Address LIKE '.$Search."%"'",$connection);
}
echo "<table border="1">
<tr>
<th>Name</th>
<th>Gender</th>
<th>Age</th>
<th>Email</th>
<th>Occupation</th>
<th>NRIC</th>
<th>Address</th>
<th>ZipCode</th>
</tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr>";
echo"<td".$row['name'].">";
echo"<td".$row['gender'].">";
echo"<td".$row['age'].">";
echo"<td".$row['email'].">";
echo"<td".$row['occupation'].">";
echo"<td".$row['nric'].">";
echo"<td".$row['address'].">";
echo"<td".$row['zipcode'].">";
echo "</tr>";
}
echo "</table>";
mysql_close($connection);
?>
</div>
</div>
</div>
</section>
<section class="stack-fixed entry-text footer clearfix">
<ul class="slat-7 first">
</ul>
<ul class="slat-3">
<li><i class="icon-envelope"></i> <a href="#">awesome@egrappler.com</a></li>
<li><i class="icon-retweet"></i> <a href="https://twitter.com/charitycycle13">Connect on Twitter</a></li>
<li><i class="icon-share-alt"></i> <a href="https://www.facebook.com/WondersOfTheWorldCharityCycle">Share With Your Friends</a></li>
<li><i class="icon-question-sign"></i> Help</li>
</ul>
<ul class="slat-2 last">
<li><a href="home.html">Home</a></li>
<li><a href="register.html">Registration</a></li>
<li><a href="admin.html">Administrator Page</a></li>
<li><a href="stats.html">Statistics</a></li>
</ul>
</section>
</article>
</div>
<!-- end .mother -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script defer src="js/accessories-min.js" type="text/javascript"></script>
<script defer src="js/site.js" type="text/javascript"></script>
<!--[if lt IE 7 ]>
<script src="https://ajax.谷歌apis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
</body>
</html><?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<!doctype html>
<!--[if lt IE 7]> <html lang="en"> <![endif]-->
<!--[if IE 7]> <html lang="en"> <![endif]-->
<!--[if IE 8]> <html lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Community Night Cycling 2014 Singapore</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable = no">
<meta name="谷歌bot" content="index, follow" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" href="style/general.css" />
<link rel="stylesheet" href="style/framework.css" />
<link rel="stylesheet" href="style/site.css" />
<script src="js/modernizr-2.0.6.min.js" type="text/javascript"></script>
</head>
<body class="contact">
<div class="mother">
<header class="mast-head stack-fixed clearfix">
<article class="logo">
<a href="index.html"></a>
</article>
<nav class="main-nav">
<ul>
<li class="first">
<a href="home.html">Home</a>
</li>
<li>
<a href="register.html">Registration</a>
</li>
<li>
<a class="selected" href="admin.html">Administrator Page</a>
</li>
<li class="last">
<a href="stats.html">Statistics</a>
</li>
</ul>
</nav><!-- end .main-nav -->
</header>
<article class="main" role="main">
<section class="stack-fixed clearfix entry-text">
<div class="top-mast contact-top-mast">
</div>
<div class="row">
<div class="slat-8">
<div id="fields">
$Search = $_POST['Search'];
if ($Search == "ALL")
{
$result = mysql_query("SELECT Name, Gender, Age, Email, Occupation, NRIC, Address, ZipCode FROM members ",$connection);
}
else
{
$result = mysql_query("SELECT Name, Gender, Age, Email, Occupation, NRIC, Address, ZipCode FROM members WHERE Address LIKE '.$Search."%"'",$connection);
}
echo "<table border="1">
<tr>
<th>Name</th>
<th>Gender</th>
<th>Age</th>
<th>Email</th>
<th>Occupation</th>
<th>NRIC</th>
<th>Address</th>
<th>ZipCode</th>
</tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr>";
echo"<td".$row['name'].">";
echo"<td".$row['gender'].">";
echo"<td".$row['age'].">";
echo"<td".$row['email'].">";
echo"<td".$row['occupation'].">";
echo"<td".$row['nric'].">";
echo"<td".$row['address'].">";
echo"<td".$row['zipcode'].">";
echo "</tr>";
}
echo "</table>";
mysql_close($connection);
?>
</div>
</div>
</div>
</section>
<section class="stack-fixed entry-text footer clearfix">
<ul class="slat-7 first">
</ul>
<ul class="slat-3">
<li><i class="icon-envelope"></i> <a href="#">awesome@egrappler.com</a></li>
<li><i class="icon-retweet"></i> <a href="https://twitter.com/charitycycle13">Connect on Twitter</a></li>
<li><i class="icon-share-alt"></i> <a href="https://www.facebook.com/WondersOfTheWorldCharityCycle">Share With Your Friends</a></li>
<li><i class="icon-question-sign"></i> Help</li>
</ul>
<ul class="slat-2 last">
<li><a href="home.html">Home</a></li>
<li><a href="register.html">Registration</a></li>
<li><a href="admin.html">Administrator Page</a></li>
<li><a href="stats.html">Statistics</a></li>
</ul>
</section>
</article>
</div>
<!-- end .mother -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script defer src="js/accessories-min.js" type="text/javascript"></script>
<script defer src="js/site.js" type="text/javascript"></script>
<!--[if lt IE 7 ]>
<script src="https://ajax.谷歌apis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
</body>
</html>
正确答案
#1
Search =
_POST['Search'];
\t\t\t\t\tif (
_POST['Search']; if (
Search == \"ALL\")
\t\t\t\t\t{
Search == "ALL") {
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcffifc
系列文章
更多
同类精品
更多
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
检查邮件是否发送成功
it1352 07-25 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22