mysql_fetch_field error

  • "Warning: mysql_fetch_field() expects parameter 2 to be long

    I can replicate this bug on the same platform as you are on.  You can change line 1375 to initialize $i to 0 rather than to "".  However, please note that this is a warning and not an error.  You can safely disable display of warnings and it won't trouble you.

    If I copy the permanent record link, I get the same search url as is displayed in my current location bar

    I cannot replicate this & don't see how it would happen.  PermaLinks are initialized to show.php links.  When you hover over a link or right click and copy, it should be a show.php link.  When you visit this link, it will automatically redirect you to the longer, search.php URL.  Are you trying to visit the permalink instead of copying it?  If you think you're doing things correctly, do you have any other web accelerator installed and/or have you tried other web browsers?

    In order to get a hold of the serial number for the record,

    Note that the serial number should be displayed in the detailed record view.

  • heem

    I also get the exact same mysql_fetch_field() warning.

  • And did the fix I described work?

  • sdearmond

    Hi Rick.  Thanks for you response.  I gave it a try, but the warning still exists.  Thank you for trying though.  And thanks for your response on the permanent link/serial number issue.  You were absolutely right.  I think I've just been staring at the same dataset for too long. 

  • I had actually meant to respond to  heemie, who did not describe his platform.

    But:  are you able to run with a lower level of warning reports?  If so, this is a non-issue.  If not, we should double-check that you implemented the fix correctly and we should see if there is anything else that needs to be fixed (for me, on the same platform, that was all that was needed).


  • heem

    I'm also running on localhost on Windows XP SP3 with the same platform:

    XAMPP Lite 1.7.3
    Apache 2.2.14
    MySQL 5.1.41
    PHP 5.3.1
    phpMyAdmin 3.2.4
    RefBase 0.9.5
    BibUtils 4.2

    The fix as I understood it was to:
    Edit on line 1375:
    $orderBy = eregi_replace("ORDER BY ", "", $newORDER);
    $orderBy = eregi_replace("ORDER BY ", 0, $newORDER);

    The fix for me doesn't change anything, the error is still there.

    If I change my error level by adding ~E_WARNING in php.ini to:

    error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING

    This hides the error.

  • Sorry that I wasn't more clear.  You need to edit search.php.  Here's the unified diff:

    --- search.php~ 2010-06-03 12:03:49.578125000 -0700
    +++ search.php  2010-06-03 12:04:17.531250000 -0700
    @@ -1372,7 +1372,7 @@
                            $HTMLafterLink = "</th>"; // close the table header tag
                            // call the 'buildFieldNameLinks()' function (defined in ''), which will return a properly formatted table header tag holding the current field's name
                            // as well as the URL encoded query with the appropriate ORDER clause:
    -                       $tableHeaderLink = buildFieldNameLinks("search.php", $query, $newORDER, $result, "", $showQuery, $showLinks, $rowOffset, $showRows, $wrapResults, $citeStyle, $HTMLbeforeLink, $HTMLafterLink, "sqlSearch", "Display", $loc["Links"], "url", $headerMsg, $viewType);
    +                       $tableHeaderLink = buildFieldNameLinks("search.php", $query, $newORDER, $result, 0, $showQuery, $showLinks, $rowOffset, $showRows, $wrapResults, $citeStyle, $HTMLbeforeLink, $HTMLafterLink, "sqlSearch", "Display", $loc["Links"], "url", $headerMsg, $viewType);
                            echo $tableHeaderLink; // print the attribute name as link
  • heem

    Thank you!
    The fix worked. I will return here if I encounter any other problems.