Jump to content

[SOLVED] HELP - Warning: mysql_num_rows(): supplied argument is not a valid MySQL result


Chezshire

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.