小编Ada*_*mMc的帖子

警告:mysql_num_rows():提供的参数不是有效的MySQL结果资源

可能重复:
警告:mysql_fetch_array():提供的参数不是有效的MySQL结果

我在下面的代码(在查询的末尾)收到以下错误消息:

警告:mysql_num_rows():提供的参数不是第28行的../view-ind-order.php中的有效MySQL结果资源

该脚本应该检索订单(从列出订单表中所有order_id行的页面),订单内容,订购用户和产品信息.我想我在哪里得到的错误是订单中有多个产品,但我不能确定我哪里出错了.(标题有会话启动命令)

     <?php 
      $page_title = 'Order';
      include ('./includes/header.html');

      if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) )
      {    
       $id = $_GET['id'];
       } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) )
       {    
       $id = $_POST['id'];
       } else { 
       echo 'This page has been accessed in error';
       include ('./includes/header.html'); 
       exit();
      }

 require_once ('mydatabase.php'); 

 $query = "SELECT us.users_id, us.users_first_name, us.users_surname, us.users_business, 
             ord.order_id, ord.users_id, ord.total, ord.order_date,  
             oc.oc_id, oc.order_id, oc.products_id, oc.quantity, oc.price
             prd.products_id, prd.products_name, prd.price      
         FROM users AS us, orders AS ord, order_contents AS oc, products AS …
Run Code Online (Sandbox Code Playgroud)

php mysql fetch

2
推荐指数
1
解决办法
4万
查看次数

PHP implode():传递的参数无效

我有一个php表单,其中有一个复选框选项,如果用户选择"其他",则会显示一个文本输入.这很好但数据没有提交.我得到错误消息PHP implode():传递的参数无效

这是:

PHP验证

if(!isset($_POST['competitor_model'])){   
echo '<p><font color="red" size="+1">• Please select at least one competitor model</font></p>';
} else {
$compmodel = implode(',', $_POST['competitor_model']); 
}
Run Code Online (Sandbox Code Playgroud)

这是JS/HTML表单

        <script type="text/javascript">
        var temp = '';
        function disableTxt() {
        var field = document.getElementById("other");
        if(field.value != '') {
        temp = field.value;
        }
        field.style.display = "none";
        field.value = '';
        }
        function enableTxt() {
        document.getElementById("other").style.display = "inline";
        document.getElementById("other").value = temp;
        }
        </script>         


        <input type="checkbox" value="BMW 3-series" onchange="disableTxt()"  name='competitor_model[]'>BMW 3-series<br>
        <input type="checkbox" value="Mercedes Benz C-class" onchange="disableTxt()"  name='competitor_model[]'>Mercedes Benz …
Run Code Online (Sandbox Code Playgroud)

php implode

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

php ×2

fetch ×1

implode ×1

mysql ×1