Jump to content

Archived

This topic is now archived and is closed to further replies.

workbench

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resour

Recommended Posts

Ok, so I'm kind of new to php.  I'm building a myspace type community for a friend using Alstrasoft e-friends.  Basically, the software blows.  Straight out of the box it had so many bugs, it took hours to get it running.

Anyway, there is a "classifieds" section where you can browse by category & subcategory(similar to craigslist) and run searches.  When I loaded up the software for the first time everything worked fine, you could post ads and run searches & everything was peachy.

Last night, I went into the "admin" section, and deleted all the categories and subcategories and added my own. 

Now, when I try to run a search I get the following message:


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/bakespac/public_html/friends/functions.php on line 28


Here's the source:


function sql_execute($sql_query,$wtr){
global $conn_id;
$sql_res=mysql_query($sql_query,$conn_id);
if($wtr=='get'){
if(mysql_num_rows($sql_res)){
return mysql_fetch_object($sql_res);
}
else {
return '';
}
}
elseif($wtr=='num'){
return mysql_num_rows($sql_res);    -------------------------------->Line 28
}
elseif($wtr=='res'){
return $sql_res;
}
}


Anyone have any ideas what the hell is going on here?

Share this post


Link to post
Share on other sites
You know what? I'm such a newbie I dont even know how to do a simple echo command.  All I know is I've seen it about 1000 times on the 50 php pages for this site.

Here's the thing...
I believe the code I posted is supposed to execute a search and return the result..Right?
Well, There are about 10 different search engines in the site.  Search for people, groups, tribes, forum posts, etc,etc,....All of them work fine except for this one.

Personally, seeing as the "admin area" of the site sucks, I have a feeling that when I deleted ALL the catagories from the classified section, and added my own(Using the janky Admin Area), somehow the table structure was modified and thats why I'm getting the error.  Is this possible?

Share this post


Link to post
Share on other sites
On a side note, I feel like the Admin Area is to blame because almost everything I do using the Admin Section ends up in disaster.  When I deleted all the catagories and added my own,  It caused the classified section to die.

It assigned all the "main categories" with a cat_id tag incrementing by 1000.  But then Assigned all the subcategories sub_cat_id tags incrementing by 1.  Meaning that the category and subcategory of For Sale ->Cars was created in the MySql Database as:

For Sale=1000
Cars=1

When It should have been

For Sale=1000
Cars=1001

I had 25 categories with about 200 sub categories and everytime you clicked on a subcategory...ERROR

I had to manually go into mysql database and add the prefixes to fix it......

Whoever made this product blows...and support is nonexistent..

Share this post


Link to post
Share on other sites

×

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.