如何解决错误“在第77行的C:\ wamp \ -www + \\ _admin-rights-display.php中除以零”。 &安培; “警告:mysql_fetch_array()期望参数1是资源,布尔值在...中给出 [英] How to solve the error "Division by zero in C:\wamp\www\admin-rights-display.php on line 77" & "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
问题描述
我创建了一个页面,用户在文本框中键入关键字并单击按钮后搜索记录。但是我收到一条错误,说在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 class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" 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="googlebot" 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="//ajax.googleapis.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 class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" 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="googlebot" 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="//ajax.googleapis.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>
推荐答案
Search =
_POST['Search'];
\t\t\t\t\tif (
_POST['Search']; if (
Search == \"ALL\")
\t\t\t\t\t{
Search == "ALL") {
这篇关于如何解决错误“在第77行的C:\ wamp \ -www + \\ _admin-rights-display.php中除以零”。 &安培; “警告:mysql_fetch_array()期望参数1是资源,布尔值在...中给出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!