• <i id='5KRVa'><tr id='5KRVa'><dt id='5KRVa'><q id='5KRVa'><span id='5KRVa'><b id='5KRVa'><form id='5KRVa'><ins id='5KRVa'></ins><ul id='5KRVa'></ul><sub id='5KRVa'></sub></form><legend id='5KRVa'></legend><bdo id='5KRVa'><pre id='5KRVa'><center id='5KRVa'></center></pre></bdo></b><th id='5KRVa'></th></span></q></dt></tr></i><div id='5KRVa'><tfoot id='5KRVa'></tfoot><dl id='5KRVa'><fieldset id='5KRVa'></fieldset></dl></div>
      • <bdo id='5KRVa'></bdo><ul id='5KRVa'></ul>
      <tfoot id='5KRVa'></tfoot>

        <legend id='5KRVa'><style id='5KRVa'><dir id='5KRVa'><q id='5KRVa'></q></dir></style></legend>

        <small id='5KRVa'></small><noframes id='5KRVa'>

        PHP:mysql_fetch_array() 期望参数 1 是资源,布尔值给定

        PHP: mysql_fetch_array() expects parameter 1 to be resource, boolean given(PHP:mysql_fetch_array() 期望参数 1 是资源,布尔值给定)

        1. <tfoot id='43fHn'></tfoot>
          <legend id='43fHn'><style id='43fHn'><dir id='43fHn'><q id='43fHn'></q></dir></style></legend>

                <small id='43fHn'></small><noframes id='43fHn'>

                  <bdo id='43fHn'></bdo><ul id='43fHn'></ul>
                    <tbody id='43fHn'></tbody>
                  <i id='43fHn'><tr id='43fHn'><dt id='43fHn'><q id='43fHn'><span id='43fHn'><b id='43fHn'><form id='43fHn'><ins id='43fHn'></ins><ul id='43fHn'></ul><sub id='43fHn'></sub></form><legend id='43fHn'></legend><bdo id='43fHn'><pre id='43fHn'><center id='43fHn'></center></pre></bdo></b><th id='43fHn'></th></span></q></dt></tr></i><div id='43fHn'><tfoot id='43fHn'></tfoot><dl id='43fHn'><fieldset id='43fHn'></fieldset></dl></div>
                  本文介绍了PHP:mysql_fetch_array() 期望参数 1 是资源,布尔值给定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能的重复:
                  MySQL &PHP 参数 1 作为资源

                  我在我网站的标题中显示,但不知道这是什么类型的错误,我也不知道如何解决这个问题.有人可以帮我吗?

                  I am getting shown in the title on my website and don't what kind of error this is, neither do I know how to fix this. Can anyone help me?

                  这是 add_answer.php 文件:

                  This is the add_answer.php file:

                  <?php
                      include("mysql_forum_test.php"); // Get value of id that sent from hidden field
                  $id=$_POST['id'];
                  
                  // Find highest answer number.
                  $sql="SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE question_id='$id'";
                  $result=mysql_query($sql);
                  $rows=mysql_fetch_array($result);
                  
                  // add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1
                  if ($rows) {
                  $Max_id = $rows['Maxa_id']+1;
                  }
                  else {
                  $Max_id = 1;
                  }
                  
                  // get values that sent from form
                  $a_name=$_POST['a_name'];
                  $a_email=$_POST['a_email'];
                  $a_answer=$_POST['a_answer'];
                  
                  $datetime=date("d/m/y H:i:s"); // create date and time
                  
                  // Insert answer
                  $sql2="INSERT INTO $tbl_name(question_id, a_id, a_name, a_email, a_answer, a_datetime)VALUES('$id', '$Max_id', '$a_name', '$a_email', '$a_answer', '$datetime')";
                  $result2=mysql_query($sql2);
                  
                  if($result2){
                  echo "Successful<BR>";
                  echo "<a href='index.php?content=view_topic?id=".$id."'>View your answer</a>";
                  
                  // If added new answer, add value +1 in reply column
                  $tbl_name2="forum_question";
                  $sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
                  $result3=mysql_query($sql3);
                  
                  }
                  else {
                  echo "ERROR";
                  }
                  
                  mysql_close();
                  ?>
                  

                  谢谢

                  推荐答案

                  根据 文档,mysql_query 在查询错误时返回 FALSE.因此,您对 mysql_fetch_array 的参数是一个布尔值.使用 mysql_error 函数查看 SELECT 查询出了什么问题.

                  Per the documentation, mysql_query returns FALSE on an error with the query. Because of this, your argument to mysql_fetch_array is a boolean. Use the mysql_error function to see what's wrong with the SELECT query.

                  例如

                  $result=mysql_query($sql) or die(mysql_error());
                  

                  这篇关于PHP:mysql_fetch_array() 期望参数 1 是资源,布尔值给定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                • <legend id='Yj9gA'><style id='Yj9gA'><dir id='Yj9gA'><q id='Yj9gA'></q></dir></style></legend>
                • <tfoot id='Yj9gA'></tfoot>

                    <i id='Yj9gA'><tr id='Yj9gA'><dt id='Yj9gA'><q id='Yj9gA'><span id='Yj9gA'><b id='Yj9gA'><form id='Yj9gA'><ins id='Yj9gA'></ins><ul id='Yj9gA'></ul><sub id='Yj9gA'></sub></form><legend id='Yj9gA'></legend><bdo id='Yj9gA'><pre id='Yj9gA'><center id='Yj9gA'></center></pre></bdo></b><th id='Yj9gA'></th></span></q></dt></tr></i><div id='Yj9gA'><tfoot id='Yj9gA'></tfoot><dl id='Yj9gA'><fieldset id='Yj9gA'></fieldset></dl></div>
                    • <bdo id='Yj9gA'></bdo><ul id='Yj9gA'></ul>

                        <small id='Yj9gA'></small><noframes id='Yj9gA'>

                              <tbody id='Yj9gA'></tbody>