0

I have hosted a new head tail gaming site. But I continously get this error message on my Index and History page.

Index Page:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1906451/public_html/index.php on line 233

History Page:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1906451/public_html/history.php on line 106

Any solution friends? Please help me out.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
  • 2
    Please post the code around the mysql_num_rows() functions in the 2 files – Adam May 15 '12 at 19:31
  • 1
    This question really shouldn't be tagged with "android" or "iphone". – strings42 May 15 '12 at 19:44
  • Are you able to access any items from your query result? Sounds like there is a problem with the query. – Gaʀʀʏ May 15 '12 at 20:07
  • Does this answer your question? [mysql\_fetch\_array()/mysql\_fetch\_assoc()/mysql\_fetch\_row()/mysql\_num\_rows etc... expects parameter 1 to be resource](https://stackoverflow.com/questions/2973202/mysql-fetch-array-mysql-fetch-assoc-mysql-fetch-row-mysql-num-rows-etc) – Dharman Sep 15 '20 at 14:50

2 Answers2

2

The argument to mysql_num_rows() expects a valid MySQL result. Most likely, you're ignoring an error from mysql_query() or trying to look at a query that doesn't return a usable result object.

Sean McSomething
  • 6,376
  • 2
  • 23
  • 28
-5

change mysql_num_rows to @mysql_num_rows in index.php on line 233 and in history.php ind line 106

Frederick Behrends
  • 3,075
  • 23
  • 47
  • 3
    This will just suppress warnings in both cases, and may just end up masking a wider problem. I'd suggest to the OP that the problem should be traced to a point earlier in the code. – halfer May 15 '12 at 19:35
  • Frederick Behrends thanks for your suggestion. Changing mysql_num_rows to @mysql_num_rows WORKED!!!!!!! Now my site is up Perfectly. Thank You once again. You can also see the change. Go to alertflips.co.cc and alertflips.co.cc/history.php. Thanks once again!!!! YAHOOOOOO!!!! – Morning Star May 15 '12 at 19:48
  • 1
    @Morning Star - that doesn't mean your code is actually *working*, it just means that PHP is silently ignoring the error. You should really consider actually *fixing* the problem rather than just preventing it from appearing. – Sean McSomething May 17 '12 at 16:54
  • Probably one of the worst answers i have seen in SO. – itachi May 26 '12 at 15:16