Jump to content

Warning: mysql_numrows(): supplied argument is not a valid MySQL result (help)


Recommended Posts

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);

 

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());

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);

 

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

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

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.