From owner-freebsd-questions Fri Aug 9 9: 3:30 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 079A837B400 for ; Fri, 9 Aug 2002 09:03:25 -0700 (PDT) Received: from sub21-156.member.dsl-only.net (sub21-156.member.dsl-only.net [63.105.21.156]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5913243E70 for ; Fri, 9 Aug 2002 09:03:24 -0700 (PDT) (envelope-from nkinkade@dsl-only.net) Received: from sub21-156.member.dsl-only.net (freebsd.localhost.localdomain [127.0.0.1]) by sub21-156.member.dsl-only.net (8.12.5/8.12.4) with SMTP id g79G4L8U019954; Fri, 9 Aug 2002 09:04:23 -0700 (PDT) (envelope-from nkinkade@dsl-only.net) Date: Fri, 9 Aug 2002 09:04:16 -0700 From: Nathan Kinkade To: "MET" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Off the Main Topic || Supplied argument is not a valid MySQL result resource Message-Id: <20020809090416.5a47f607.nkinkade@dsl-only.net> In-Reply-To: <001801c23fbc$879e5f60$6701a8c0@SURVIVAL> References: <001801c23fbc$879e5f60$6701a8c0@SURVIVAL> X-Mailer: Sylpheed version 0.7.8claws (GTK+ 1.2.10; i386-portbld-freebsd4.6) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 9 Aug 2002 11:50:47 -0400 "MET" wrote: > I realize that this is off topic, but I'm sending it to more specific > PHP lists as well but none of them have such helpful people on them. > > I'm getting some massive errors on some pretty simple code. Included > are the errors as well as the PHP function that is giving me issues. > Any help would be greatly appreciated. And the weirdest thing, is > that the code used to work.... ?? > > Line 267 is equal to this PHP line: > > $RSM = mysql_fetch_array($resultm); > > ============================= > ERRORS: > ============================= > > Warning: Supplied argument is not a valid MySQL result resource in > D:\Gunks\NewSite\phpAds\view.inc.php3 on line 267 > CODE: > ============================= > > function view_order($keywords, $id) > { > global $phpAds_db, $phpAds_hostname, $phpAds_mysqluser, > $phpAds_mysqlpassword, $REMOTE_HOST, $USER, $phpAds_tbl_banners; > mysql_connect($phpAds_hostname,$phpAds_mysqluser,$phpAds_mysqlpasswor > d) or die("Unable to connect to database"); > @mysql_select_db("$phpAds_db") or die("Unable to select database > $phpAds_db"); > > if($USER[$id]["cbannerID"] == -1) > { > $sqlm = "SELECT MIN(bannerID), MAX(bannerID) FROM > banners WHERE active='true';"; > > $resultm = mysql_query($sqlm); > > $RSM = mysql_fetch_array($resultm); This may be my own lack of knowledge on PHP, but what is the "@" symbol before your call to mysql_select_db? I'm not familiar with that construct in PHP, only PERL, but again, it may just be that I don't know PHP well enough. Also, are you sure that your query ($sqlm) is returning any results? Try checking for a result set with mysql_num_rows before fetching the result array. I see that you are using the mysql_num_rows function at other places in your code. Nathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message