Always check for errors on a mysql_query() call.  Like so:

$result = mysql_query($cd_qry);
if(!$result) {
    echo mysql_errno().":".mysql_error();
}

That should give you an idea.  Usually this error happens when your query
fails for some reason and thus it doesn't return any rows.  When you then
try to extract rows it complains.

-Rasmus

On Mon, 9 Apr 2001, Liz Bander wrote:

> This is the error that I've gotten since I switched servers a week-ish
> ago.  No idea why, doesn't make any sense to me.  I'm running MySQL 3.23
> and the latest versions of Apache and PHP.  We used the nusphere install.
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/nusphere/apache/htdocs/ese-lab/Protect/add.php3 on line 162
>
> Any ideas??? Thanks!!!
>
> Liz Bander
>
> This is the function that it's in:
>
> #======================================================================
>
> # sub main() {
>
>
>    if ($cancel != '') {
>      include '../Include/conf.inc';
>      header("Location: http://$WEB_SERV/$WEB_SITE" . "search.php3");
>      exit;
>    } elseif ($save != '') {
>      include '../Include/conf.inc';
>      $err_str = validate();
>      if ($err_str == '') {
>        add_log_entry($bcode);
>        $message = write_to_db($bcode);
>        #$A($message);
>        exit;
>      } else {
>        if (substr($err_str, -1, 1) != '!') {
>          $conflict_code = substr($err_str, -11, 10);
>          $err_str = $err_str . " <a
> href='box_edit.php3?bcode=$conflict_code&db=yes&goto=" . urlencode($goto) .
> "'>--></a>";
>        }
>      }
>    } else {
>      include '../Include/conf.inc';
>      $cd_qry = "select max(code) from equipment";
>      connecttodb();
>      $result = mysql_query($cd_qry);
> LINE 162    $temp = mysql_fetch_row($result);
>      $bcode = $BCODE_START . str_pad((substr($temp[0], -6) +
> 1),6,'0',STR_PAD_LEFT);
>    }
>
>    include '../Include/ip_crd_tbl.inc';
>    include '../Include/show_list.inc';
>
> #======================================================================


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to