Chezshire Posted May 26, 2008 Share Posted May 26, 2008 Hello to one and all, especially anyone who can help me solve my problem which is beyond my little cancer soaked brain* at the moment. To summarize my issue: People with Vista who go to www.xpg.us/cerebra.php get the following error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in/home/content/XPG/html/xpg/functions.phpon line 205 A screen shot of the problem can be seen here: www.xpg.us/VistaViewedError.jpg This is the code from line 205 of the functions.php file which is indicated as the offending line of code: if (mysql_num_rows($resultTemp)) { This is the code for that overall portion of the functions.php file // now we've got our list. If there are any criteria in it, we'll compress it and // prepare it for insertion into an SQL query. $newVars = ", (tags = \"Everyone\") AS evHL"; $criteria = "(tags = \"Everyone\")"; if (count($charArray)) { $newVars = $newVars . ", (" . implode(" OR ", $charArray) . ") AS hl"; $criteria .= " OR " . implode(" OR ", $charArray); } else { $newVars = $newVars . ", 0 AS hl"; } // end if any characters to show $cookieAddon = ""; if ($hlTimestamp) { $cookieAddon = "AND dateadded > $hlTimestamp"; } // this section searches for threads featuring this user's characters and puts them in a list. // it only brings back a list of threads that should be highlighted, which should speed up the // process compared to the old way $hlTemp = "SELECT thread$newVars from board WHERE ($criteria) AND approved <> '' AND approved IS NOT NULL AND TO_DAYS(NOW()) - TO_DAYS(dateadded) <= $useLimit $cookieAddon GROUP BY thread"; echo "\n\n<!-- SQL (highlighting): $hlTemp -->\n\n"; $resultTemp = mysql_query($hlTemp); if (mysql_num_rows($resultTemp)) { // echo "<!--ROWS: " . mysql_num_rows($resultTemp) . " -->\n"; WHILE ($hlCheck = mysql_fetch_assoc($resultTemp)) { $thread = $hlCheck["thread"]; if ($hlCheck["evHL"] && !in_array($thread, $evThreads)) { array_push($evThreads, $thread); } else if ($hlCheck["hl"] && !in_array($thread, $hlThreads)) { array_push($hlThreads, $thread); } // end if any highlighted posts in the last [however many they set] } // end WHILE highlight checking $newTimestamp = date('YmdHis'); $hlTemp = implode(",",$hlThreads); $evTemp = implode(",",$evThreads); $cookieContents = "$newTimestamp\n$hlTemp\n$evTemp"; $duration = 31536000; // one year setcookie ("hlPosts", $cookieContents, time() + $duration, "/",".xpg.us"); // echo "<!-- SET COOKIE: $cookieContents -->\n"; } // end if there were new posts to add to the list return array($hlThreads, $evThreads); } // end function Once again, any help would be greatly appreciated. Thank you very very much! Chez *I have a slight touch of brain cancer which is inoperable, and while it's only a little cancer, you know what they say, a little dab will do you. Morbid jokes aside, i've been trying to distract myself by teaching myself php and this problem is really just beyond me. The thing which makes this so bizarre a problem to me is that only people running VISTA seem to be experiencing it. You can view a screen shot by going to 'www.xpg.us/VistaViewedError.jpg' Everyone else who goes to the www.xpg.us/php.us sees the page as intended to the best of my knowledge. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 26, 2008 Share Posted May 26, 2008 That just means there is a problem with your query. Add a die error at the end of this line: $resultTemp = mysql_query($hlTemp); Like so $resultTemp = mysql_query($hlTemp)or die(mysql_error() . "<p>With Query:<br>$hlTemp"); Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted May 26, 2008 Share Posted May 26, 2008 echo $hlTemp. It will tell you the SQL code being generated, you should be able to find out problems from that. If not copy the echoed code into MySQL query browser or similar tool and experiment with the query until it works. Quote Link to comment Share on other sites More sharing options...
Chezshire Posted May 26, 2008 Author Share Posted May 26, 2008 Hello and thank you for the advice. I'm a complete novice who has some very smart and savy PHP friends who sometimes help me because i'm a pudding-head just so you know. So that said, would i enter the following code into my functions.php page as so: <?php echo $hlTemp ?> Or would i add it on line 206 following where the error is being reporting? Any guidance is always appreciated and I promise i'll put you in my prayers (And i might be dead soon, so i might be like a fedEx to god about how nice you are - laughs - Sorry if my morbid humor offends anyone, but it's this or cry and last time i checked i can't see anything when i'm crying -Chez Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 26, 2008 Share Posted May 26, 2008 Replace the line in your code exactly with the code I supplied you. P.S. - Best of luck with your health. Quote Link to comment Share on other sites More sharing options...
Chezshire Posted May 26, 2008 Author Share Posted May 26, 2008 Thank you Very VERY MUCH, I was able to solve it all by my little lonesome (thats entirely to you of course and this wonderful place!) I'm trying to mark this solved now. And thanks for the well wishs - i'm off to lay down for a bit hugs and smiles Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.