workbench Posted July 3, 2006 Share Posted July 3, 2006 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 28Here'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? Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/ Share on other sites More sharing options...
hackerkts Posted July 3, 2006 Share Posted July 3, 2006 What's your $sql_res ? Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/#findComment-52353 Share on other sites More sharing options...
workbench Posted July 3, 2006 Author Share Posted July 3, 2006 where do I find that value? Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/#findComment-52360 Share on other sites More sharing options...
Brandon Jaeger Posted July 3, 2006 Share Posted July 3, 2006 Echo the value of $sql_res. Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/#findComment-52364 Share on other sites More sharing options...
workbench Posted July 3, 2006 Author Share Posted July 3, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/#findComment-52377 Share on other sites More sharing options...
workbench Posted July 3, 2006 Author Share Posted July 3, 2006 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=1000Cars=1When It should have beenFor Sale=1000Cars=1001I had 25 categories with about 200 sub categories and everytime you clicked on a subcategory...ERRORI had to manually go into mysql database and add the prefixes to fix it......Whoever made this product blows...and support is nonexistent.. Quote Link to comment https://forums.phpfreaks.com/topic/13517-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resour/#findComment-52378 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.