Re: [PHP-DB] Supplied argument is not a valid MySQL result resource
add an... or die(mysql_error()) to the $resultm = mysql_query($sqlm); statement and you'll have a lot more info for yourself, and the list if you still need assistance. "MET" .com>cc: Subject: [PHP-DB] Supplied argument is not a valid MySQL result 08/09/2002resource 11:46 AM 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 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 269 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 287 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 289 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 295 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 297 less than one inside of nothing found. Warning: Undefined index: format in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 327 Warning: Undefined index: bannerID in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: bannerID in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: width in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: height in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: alt in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 = CODE: = function view_order($keywords, $id) { global $phpAds_db, $phpAds_hostname, $phpAds_mysqluser, $phpAds_mysqlpassword, $REMOTE_HOST, $USER, $phpAds_tbl_banners; if(!isset($USER[$id]["cbannerID"])) $USER[$id]["cbannerID"] = -1; # $text = explode("/", $keywords); $keywords = ""; $x = 0; foreach($text as $line) { if( $x == 0 ) { $keywords = "(keyword LIKE '%" . $line . "%'"; } else { $keywords = $keywords . " OR keyword LIKE '%" . $line . "%'"; } $x++; } $keywords .= ")"; # mysql_connect($phpAds_hostname,$phpAds_mysqluser,$phpAds_mysqlpassword) 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); if( mysql_num_rows($resultm) < 1 ) { $num1 = rand(1, 100); } Else { $num1 = rand($RSM[0], $RSM[1]); } $sql = "SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords AND bannerID >= $num1 ORDER BY bannerID LIMIT 0,1;"; } else { $sql = "SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords AND bannerID > " . $USER[$id]["cbannerID"] . " ORDER BY bannerID LIMIT 0,1;"; } $result = mysql_query($sql); $RS = mysql_fetch_array($result); if( mysql_num_rows($result) < 1 ) { $sql2 = "SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords ORDER BY bannerID LIMIT 0,1;"; $result2 = mysql_query($sql2); $RS2 = mysql_fetch_array($result2); if( mysql_num_rows($result2) < 1 ) { echo "less than one inside of nothing found."; } Else { $USER[$id]["bannerID"] = $RS2["bannerID"]; $USER[$id]["banner"] = $RS2["banner"]; $USER[$id]["format"
RE: [PHP-DB] Supplied argument is not a valid MySQL result resource...
> -Original Message- > From: Klaus Haberkorn [mailto:[EMAIL PROTECTED]] > Sent: Saturday, April 21, 2001 6:18 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Supplied argument is not a valid MySQL result > resource... > > > Looks like many reasons cause this error-message, > but I cannot find a problem in the Query: > ie.: > $db_handle = mysql_connect("localhost", "mysql", "mysql"); > if($db_handle) > { > $result = mysql_db_query("mysql", "select * from user", $db_handle); > if($result = TRUE) if ($result == TRUE) --- Mark Roedel ([EMAIL PROTECTED]) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University ||-- Henry Kissinger -- 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]
[PHP-DB] STOPIT! Re: [PHP-DB] Supplied argument is not a valid MySQL result resource...
I found out that it is not a question of query-statement. When I move the test page to my apache-doc-root, it works, so there should be some configuration necessary.. we'll find it. "Klaus Haberkorn" <[EMAIL PROTECTED]> schrieb in im Newsbeitrag: 9brpnv$5jf$[EMAIL PROTECTED] > Looks like many reasons cause this error-message, > but I cannot find a problem in the Query: > ie.: > $db_handle = mysql_connect("localhost", "mysql", "mysql"); > if($db_handle) > { > $result = mysql_db_query("mysql", "select * from user", $db_handle); > if($result = TRUE) > { >$row = mysql_num_rows($result); > () > The same simplified statement works fine in the Win32-client-tool, > connected as the same user. > The table "user" exists and "mysql" has any privileges from localhost and % > in "user" and "db" > I surely made some experiments with Caps or not. > I built a new apache 1.3.12 with a static php4.0.4pl1 module and > mysql-support. > Runs fine, but the problem is the same. > I have no more idea... > > "Johannes Janson" <[EMAIL PROTECTED]> schrieb in im Newsbeitrag: > 9bhkqv$aai$[EMAIL PROTECTED] > > Hi, > > > > i don't get that. > > Examlpe: tablename: test , entry: id 001; name: John Doe > > > > $result = mysql_query("SELECT * FROM test"); > > $row = mysql_fetch_whatever($result); // everything ok > > > > > > $result = mysql_query("SELECT * FROM tet"); > > $row = mysql_fetch_wahtever($result); // Warning: Supplied arggument is > not > > a valid > > > > $result = mysql_query("SELECT nonexistent FROM test"); > > $row = mysql_fetch_whatever($result); // Warning: Supplied argument is not > > > > > > $result = mysql_query("SELECT * FROM test WHERE id='002'"); > > $row = mysql_fetch_whatever($result); // no errormsg, $result=true but > empty > > > > That's what I get. So there must be something wrong with the query. > > > > Johannes > > > > > > ""Klaus Haberkorn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > 9bhh1c$2gg$[EMAIL PROTECTED]">news:9bhh1c$2gg$[EMAIL PROTECTED]... > > > thank You, Johannes, > > > but I think we can skip this, > > > we reduced the query statement to the most simple one: > > > "SELECT * FROM {tablename}" > > > if the tablename is wrong, then another error message is issued. > > > the result is not treated by a while-loop but just by fetch_num_rows, > > > which at least reports the error. > > > (and, by the way, the same script runs on another system) > > > so we are more looking for problems with apache versions > > > and/or modules. > > > we also checked access-rights, but this also causes different errors. > > > any other idea? > > > > > > > > > > > > > -- > > 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] > > > > > > -- > 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] > -- 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]
Re: [PHP-DB] Supplied argument is not a valid MySQL result resource...
Looks like many reasons cause this error-message, but I cannot find a problem in the Query: ie.: $db_handle = mysql_connect("localhost", "mysql", "mysql"); if($db_handle) { $result = mysql_db_query("mysql", "select * from user", $db_handle); if($result = TRUE) { $row = mysql_num_rows($result); () The same simplified statement works fine in the Win32-client-tool, connected as the same user. The table "user" exists and "mysql" has any privileges from localhost and % in "user" and "db" I surely made some experiments with Caps or not. I built a new apache 1.3.12 with a static php4.0.4pl1 module and mysql-support. Runs fine, but the problem is the same. I have no more idea... "Johannes Janson" <[EMAIL PROTECTED]> schrieb in im Newsbeitrag: 9bhkqv$aai$[EMAIL PROTECTED] > Hi, > > i don't get that. > Examlpe: tablename: test , entry: id 001; name: John Doe > > $result = mysql_query("SELECT * FROM test"); > $row = mysql_fetch_whatever($result); // everything ok > > > $result = mysql_query("SELECT * FROM tet"); > $row = mysql_fetch_wahtever($result); // Warning: Supplied arggument is not > a valid > > $result = mysql_query("SELECT nonexistent FROM test"); > $row = mysql_fetch_whatever($result); // Warning: Supplied argument is not > > > $result = mysql_query("SELECT * FROM test WHERE id='002'"); > $row = mysql_fetch_whatever($result); // no errormsg, $result=true but empty > > That's what I get. So there must be something wrong with the query. > > Johannes > > > ""Klaus Haberkorn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 9bhh1c$2gg$[EMAIL PROTECTED]">news:9bhh1c$2gg$[EMAIL PROTECTED]... > > thank You, Johannes, > > but I think we can skip this, > > we reduced the query statement to the most simple one: > > "SELECT * FROM {tablename}" > > if the tablename is wrong, then another error message is issued. > > the result is not treated by a while-loop but just by fetch_num_rows, > > which at least reports the error. > > (and, by the way, the same script runs on another system) > > so we are more looking for problems with apache versions > > and/or modules. > > we also checked access-rights, but this also causes different errors. > > any other idea? > > > > > > > -- > 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] > -- 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]
Re: [PHP-DB] Supplied argument is not a valid MySQL result resource...
Hi, i don't get that. Examlpe: tablename: test , entry: id 001; name: John Doe $result = mysql_query("SELECT * FROM test"); $row = mysql_fetch_whatever($result); // everything ok $result = mysql_query("SELECT * FROM tet"); $row = mysql_fetch_wahtever($result); // Warning: Supplied arggument is not a valid $result = mysql_query("SELECT nonexistent FROM test"); $row = mysql_fetch_whatever($result); // Warning: Supplied argument is not $result = mysql_query("SELECT * FROM test WHERE id='002'"); $row = mysql_fetch_whatever($result); // no errormsg, $result=true but empty That's what I get. So there must be something wrong with the query. Johannes ""Klaus Haberkorn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 9bhh1c$2gg$[EMAIL PROTECTED]">news:9bhh1c$2gg$[EMAIL PROTECTED]... > thank You, Johannes, > but I think we can skip this, > we reduced the query statement to the most simple one: > "SELECT * FROM {tablename}" > if the tablename is wrong, then another error message is issued. > the result is not treated by a while-loop but just by fetch_num_rows, > which at least reports the error. > (and, by the way, the same script runs on another system) > so we are more looking for problems with apache versions > and/or modules. > we also checked access-rights, but this also causes different errors. > any other idea? > -- 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]
Re: [PHP-DB] Supplied argument is not a valid MySQL result resource...
thank You, Johannes, but I think we can skip this, we reduced the query statement to the most simple one: "SELECT * FROM {tablename}" if the tablename is wrong, then another error message is issued. the result is not treated by a while-loop but just by fetch_num_rows, which at least reports the error. (and, by the way, the same script runs on another system) so we are more looking for problems with apache versions and/or modules. we also checked access-rights, but this also causes different errors. any other idea? ""Johannes Janson"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 9bh6jh$346$[EMAIL PROTECTED]">news:9bh6jh$346$[EMAIL PROTECTED]... > Hi, > > you usually get the error if your query is wrong and > you try to call mysql_fetch_array in a while loop. > > It's easier if you post the relevant lines of code but > I'd say there is something wrong with your query. > > Johannes > > > ""Klaus Haberkorn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 9bh369$d2h$[EMAIL PROTECTED]">news:9bh369$d2h$[EMAIL PROTECTED]... > > Installation Details: > > SuSE Linux 7.1 kernel 2.4 + apache 1.3.14 + php4.0.4pl1-1 + mysql > 3.23.30-2 > > > > The following error message appears: > > "Warning: Supplied argument is not a valid MySQL result resource in > > /www/wp/php/login.php on line 29" > > > > Remarks: > > php4 runs fine and returns "not FALSE" for function mysql_db_query (means > > query is ok) or mysql_query. > > But the result of the query causes the error above. Any other function > using > > the query-result does so also. > > The same php-script runs fine on other systems with the same environment. > > The Access-Rights are completely "open" for the whole development site and > > all of the mysql-users have > > full access, there are only a few test-records in the table (no question > of > > size!). > > > > Can anybody help us with this problem? > > Thanks in Advance > > Klaus > > ([EMAIL PROTECTED] and/or [EMAIL PROTECTED]) > > > > > > > > > > -- > > 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] > > > > > > -- > 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] > -- 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]
Re: [PHP-DB] Supplied argument is not a valid MySQL result resource...
Hi, you usually get the error if your query is wrong and you try to call mysql_fetch_array in a while loop. It's easier if you post the relevant lines of code but I'd say there is something wrong with your query. Johannes ""Klaus Haberkorn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 9bh369$d2h$[EMAIL PROTECTED]">news:9bh369$d2h$[EMAIL PROTECTED]... > Installation Details: > SuSE Linux 7.1 kernel 2.4 + apache 1.3.14 + php4.0.4pl1-1 + mysql 3.23.30-2 > > The following error message appears: > "Warning: Supplied argument is not a valid MySQL result resource in > /www/wp/php/login.php on line 29" > > Remarks: > php4 runs fine and returns "not FALSE" for function mysql_db_query (means > query is ok) or mysql_query. > But the result of the query causes the error above. Any other function using > the query-result does so also. > The same php-script runs fine on other systems with the same environment. > The Access-Rights are completely "open" for the whole development site and > all of the mysql-users have > full access, there are only a few test-records in the table (no question of > size!). > > Can anybody help us with this problem? > Thanks in Advance > Klaus > ([EMAIL PROTECTED] and/or [EMAIL PROTECTED]) > > > > > -- > 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] > -- 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]