Jump to content


Photo

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


  • Please log in to reply
5 replies to this topic

#1 workbench

workbench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 03 July 2006 - 05:32 AM

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?



#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 03 July 2006 - 06:24 AM

What's your $sql_res ?

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#3 workbench

workbench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 03 July 2006 - 06:34 AM

where do I find that value?

#4 Brandon Jaeger

Brandon Jaeger
  • Members
  • PipPipPip
  • Advanced Member
  • 155 posts
  • LocationPA
  • Age:25

Posted 03 July 2006 - 06:40 AM

Echo the value of $sql_res.
PHP is my friend (=

#5 workbench

workbench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 03 July 2006 - 07:13 AM

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?


#6 workbench

workbench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 03 July 2006 - 07:25 AM

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..





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users