mysql_fetch_array()期望参数1 - wordpress插件错误

时间:2012-10-10 08:13:03

标签: php mysql

  

可能重复:
  mysql_fetch_array() expects parameter 1 to be resource problem

  

警告:mysql_fetch_array()要求参数1为资源,在第19行的/home/skidrowg/public_html/wp-content/plugins/astickypostorderer/croer-transact.php中给出布尔值   错误:您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第1行的''附近使用正确的语法

这是croer-transact.php代码:

<?php
$croer_list = $_POST;
$croer_action = $croer_list[submit];
require_once('croer-functions.php');
if ($croer_action == 'Save and Refresh') {
    // lets clean up the incomming
    $croer_ins_buffer = array(); // to hold what needs to be inserted
    foreach ($croer_list as $croer_pid => $croer_element) {
        if ((!strncmp($croer_pid, 'pid', 3))&&($croer_element!='')) {
            $croer_ins_buffer[substr($croer_pid,3)]=$croer_element;
        }
    }
}
$croer_cat = $croer_list[croer_cat];
if ($croer_ins_buffer) {
    asort($croer_ins_buffer);
}
$croer_old_sorts = croer_get_just_sorted($croer_cat);
while ($row= mysql_fetch_array($croer_old_sorts)) {
    $croer_old_sorts_r[$row[post_id]]=$row[post_rank];
}
if ($croer_old_sorts_r) {
    asort($croer_old_sorts_r);
}
// loop through ellements to insert in new array
// keep offset
$c_new_inserts=array();
$c_removals=array();
$c_ofset=0;
if ($croer_ins_buffer) {
    echo "<!-- >We have insertions< -->";

1 个答案:

答案 0 :(得分:0)

$ croer_old_sorts设置为croer_get_just_sorted($ croer_cat)的值,这显然是一个布尔值。然后将该值传递给mysql_fetch_array函数。

mysql_fetch_array接受通过执行mysql_query命令生成的结果集,如下所示:

$result = mysql_query("SELECT * FROM table_name");
while($row=mysql_fetch_array($result){
...

不赞成使用FYI mysql库来支持mysqli库。