Eruondo Posted June 11, 2009 Posted June 11, 2009 I'm trying to add this in my header, but no matter what I do, it just shows the first result. Could you take a look and tell me if there is anything wrong? $vote = $db->query("SELECT list FROM votes WHERE userid = ".$ir['userid']." "); if(mysql_num_rows($vote) != trpg) { echo "<font color='#FFFFFF'>You haven't voted at TopRPG today! Do it now!</font> "; } elseif(mysql_num_rows($vote) != twg) { echo "<font color='#FFFFFF'>You haven't voted at TopWebGames today! Do it now! "; } elseif(mysql_num_rows($vote) != tpg) { echo "<font color='#FFFFFF'>You haven't voted at TopRankinGames today! Do it now! "; } elseif(mysql_num_rows($vote) != apex) { echo "<font color='#FFFFFF'>You haven't voted at Apex today! Do it now! "; } else { echo "<font color='#FFFFFF'>You've already voted today. "; } Quote
Eruondo Posted June 11, 2009 Author Posted June 11, 2009 Re: voting help I tried adding a else just now, but I've still got the same problem. Any ideas? Quote
Lithium Posted June 12, 2009 Posted June 12, 2009 Re: voting help as BD23 said... mysql_num_rows() will only return 1/2/3/whatever rows there are or FALSE, if you need to check for certain fields (hint: trpg(voting site)) you need at least the mysql_fetch_array(), my advice... check what is what and go from there! Quote
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.