gatez Posted November 29, 2007 Share Posted November 29, 2007 Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource this is line 17------> $num = mysql_numrows($result); Here is a snippet $query .= " GROUP BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15"; mysql_connect('localhost',$mysqlusername,$mysqlpassword); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query($query); mysql_close(); $num = mysql_numrows($result); Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/ Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 anyone any ideas? do you need more info? Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402442 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 when you get that error means your query failed so try to fix your query.. Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402456 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 how do i do that ? Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402460 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 correct your sql statement or your select ok print your query and paste that here and we will try to take a look Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402462 Share on other sites More sharing options...
PFMaBiSmAd Posted November 29, 2007 Share Posted November 29, 2007 Get mysql to help you find what is wrong by putting some error checking and error reporting on the mysql_query() function call. $result = mysql_query($query) or die("Query failed: " . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402465 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 where do i put that and how do i view the errors im kinda new to this thanks again Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402466 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 Get mysql to help you find what is wrong by putting some error checking and error reporting on the mysql_query() function call. $result = mysql_query($query) or die("Query failed: " . mysql_error()); yah this is one way of debugging and the other way is to print your query $query .= " GROUP BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15"; echo $query ; mysql_connect('localhost',$mysqlusername,$mysqlpassword); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query($query) or die("Query failed: " . mysql_error()); mysql_close(); $num = mysql_numrows($result); Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402467 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 ok did that how do i find the error ? Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402470 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 paste here the results.. the output from the echo i placed over there and the result form the die Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402472 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 where do i find the results Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402475 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 nah .. ok post all the output of that page and ill try to find it for you Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402479 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 its hooked in to an api so if i put in the adresses it come up this http://www.pimpthatsite.com/rather_fight/friends.php Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402480 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 in cant open your site sorry ! Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402482 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15Query failed: Invalid use of group function this is the error i got when i loged on to the app Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402485 Share on other sites More sharing options...
gatez Posted November 29, 2007 Author Share Posted November 29, 2007 BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15Query failed: Invalid use of group function this is the error i got when i loged on to the app Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402487 Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 you have to give us the whole query or els ill be answering a guess.. you have to show us something like select * from tablename group BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15 if you paste the code i gave you you should be seeing something like thatas an out put please post that here Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402499 Share on other sites More sharing options...
gatez Posted November 30, 2007 Author Share Posted November 30, 2007 SELECT ratings_winner FROM `ratings` WHERE ratings_winner='634794851' OR ratings_winner=305300379 OR ratings_winner=500254115 OR ratings_winner=500300799 OR ratings_winner=501793914 OR ratings_winner=504304794 OR ratings_winner=505410815 OR ratings_winner=505905624 OR ratings_winner=506298469 OR ratings_winner=506661532 OR ratings_winner=507668933 OR ratings_winner=508256272 OR ratings_winner=509671350 OR ratings_winner=509733755 OR ratings_winner=510103823 OR ratings_winner=510311239 OR ratings_winner=510312727 OR ratings_winner=510419835 OR ratings_winner=510430487 OR ratings_winner=510473822 OR ratings_winner=510675385 OR ratings_winner=510779487 OR ratings_winner=510910671 OR ratings_winner=510986403 OR ratings_winner=511203549 OR ratings_winner=511322920 OR ratings_winner=511458462 OR ratings_winner=511520539 OR ratings_winner=511588971 OR ratings_winner=511728077 OR ratings_winner=511882162 OR ratings_winner=511885163 OR ratings_winner=511935714 OR ratings_winner=511986722 OR ratings_winner=512107761 OR ratings_winner=512123009 OR ratings_winner=512207069 OR ratings_winner=512383175 OR ratings_winner=512672921 OR ratings_winner=512734820 OR ratings_winner=513128360 OR ratings_winner=513259991 OR ratings_winner=513360934 OR ratings_winner=513476701 OR ratings_winner=513537732 OR ratings_winner=513826787 OR ratings_winner=514043586 OR ratings_winner=514710890 OR ratings_winner=514828125 OR ratings_winner=514858557 OR ratings_winner=514925605 OR ratings_winner=515025359 OR ratings_winner=515040957 OR ratings_winner=515635376 OR ratings_winner=515967710 OR ratings_winner=516234997 OR ratings_winner=517017717 OR ratings_winner=517530102 OR ratings_winner=517559938 OR ratings_winner=518346952 OR ratings_winner=518606809 OR ratings_winner=519470345 OR ratings_winner=525936276 OR ratings_winner=542476557 OR ratings_winner=544155260 OR ratings_winner=545218893 OR ratings_winner=548446078 OR ratings_winner=550156007 OR ratings_winner=550670603 OR ratings_winner=557425994 OR ratings_winner=558640071 OR ratings_winner=558955260 OR ratings_winner=561145478 OR ratings_winner=562520095 OR ratings_winner=562862613 OR ratings_winner=564167976 OR ratings_winner=564869545 OR ratings_winner=566038026 OR ratings_winner=579928938 OR ratings_winner=580177400 OR ratings_winner=590307393 OR ratings_winner=590805256 OR ratings_winner=591755327 OR ratings_winner=591805290 OR ratings_winner=592634182 OR ratings_winner=598320089 OR ratings_winner=598430525 OR ratings_winner=605520164 OR ratings_winner=607860117 OR ratings_winner=610265243 OR ratings_winner=610455396 OR ratings_winner=618718240 OR ratings_winner=622450633 OR ratings_winner=623670007 OR ratings_winner=625340190 OR ratings_winner=630275253 OR ratings_winner=638275547 OR ratings_winner=639766824 OR ratings_winner=640036779 OR ratings_winner=642365214 OR ratings_winner=643320626 OR ratings_winner=651900310 OR ratings_winner=652155164 OR ratings_winner=654485337 OR ratings_winner=659351474 OR ratings_winner=665975787 OR ratings_winner=669794262 OR ratings_winner=672575093 OR ratings_winner=675146821 OR ratings_winner=676362914 OR ratings_winner=681030242 OR ratings_winner=686365378 OR ratings_winner=690309258 OR ratings_winner=691785651 OR ratings_winner=692585227 OR ratings_winner=696510524 OR ratings_winner=701210660 OR ratings_winner=703090026 OR ratings_winner=704110541 OR ratings_winner=711200083 OR ratings_winner=712013950 OR ratings_winner=713765503 OR ratings_winner=720776550 OR ratings_winner=725773785 OR ratings_winner=726225303 OR ratings_winner=731360429 OR ratings_winner=734455415 OR ratings_winner=738234452 OR ratings_winner=738390273 OR ratings_winner=744410082 OR ratings_winner=770662932 OR ratings_winner=783445031 OR ratings_winner=792175213 OR ratings_winner=861400634 OR ratings_winner=874510396 OR ratings_winner=875785088 OR ratings_winner=894440206 OR ratings_winner=896330388 GROUP BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15Query failed: Invalid use of group function Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402513 Share on other sites More sharing options...
teng84 Posted November 30, 2007 Share Posted November 30, 2007 try something like this SELECT ratings_winner FROM `ratings` WHERE ratings_winner IN ('634794851','305300379','500254115','500300799','501793914','504304794','508256272','509733755','510473822') GROUP BY ratings_winner ORDER BY count( ratings_winner ) DESC LIMIT 0 , 15 lol who taught that multiple or Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402544 Share on other sites More sharing options...
teng84 Posted November 30, 2007 Share Posted November 30, 2007 you can use select within select to get those id's hmm something like this select from tablename where yourid in (select id form your2ndtable) if you still cant figure this out hmm post more of your codes Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402576 Share on other sites More sharing options...
fenway Posted November 30, 2007 Share Posted November 30, 2007 Yeesh... where's the rest of the query? Quote Link to comment https://forums.phpfreaks.com/topic/79472-warning-mysql_numrows-supplied-argument-is-not-a-valid-mysql-result-help/#findComment-402914 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.