DreamCoder Posted August 25, 2010 Share Posted August 25, 2010 i have a problem with mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\header.php on line 81 the codes is "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c); if(mysql_num_rows($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; can u reype the corrections please Quote Link to comment Share on other sites More sharing options...
Uridium Posted August 25, 2010 Share Posted August 25, 2010 try changing mysql_num_rows to mysql_fetch_assoc and see if that helps Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 when i change to mysql_fetch_assoc it says mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\header.php on line 81 Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted August 25, 2010 Share Posted August 25, 2010 Shouldn't it be if(!mysql_num_rows Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 when i put ! it dont work Call to undefined function mysql_nums_rows() in C:\xampp\htdocs\header.php on line 81 Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted August 25, 2010 Share Posted August 25, 2010 Your calling mysql_NUMS_rows I'm telling you too call mysql_NUM_rows Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 Dont know how to call them Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c); if(mysql_fetch_assoc($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; there is no .com :/ sorry im new to mysql stuff Quote Link to comment Share on other sites More sharing options...
Dave Posted August 25, 2010 Share Posted August 25, 2010 This post made me laugh aha "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c); if(mysql_num_rows($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; Try that DreamCoder Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 still say Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\header.php on line 81 Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 also cause of the free mods i got for v1 says mysql_fetch_array() expects parameter 1 to be resource, boolean given in Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 25, 2010 Share Posted August 25, 2010 Sorry, I don't know much of MYSQL, so I cannot help you, sorry. But this is kind of p]weird. :/ "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c); if(mysql_num_rows($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; Maybe try? o_0 // Put what ever come before this is. $Query = mysql_query("SELECT * FROM `ads` ORDER BY rand() LIMIT 1" , $c) or die('Mysql error!'); // Try to select WHAT'S needed if (mysql_num_rows($Query) ) { // Opening print "<table width = '100%'> <tr> <th>????</th> </tr> <tr> <td width = '20%' valign='top'>WHAT EVER HERE</th> // IOutput here. </tr> </table>"; } // Closing I think the table should be included there(fully). If some things are there(in the table) that arn't needed. Just remove. Quote Link to comment Share on other sites More sharing options...
Equinox Posted August 25, 2010 Share Posted August 25, 2010 "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c) or die(mysql_error()); if(mysql_num_rows($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; I'm thinking something is existing here.... Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted August 25, 2010 Share Posted August 25, 2010 @OP - show us all the code, Jesus this is like Guess who .... help us and we may be able to help you. Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 <?php class headers { function startheaders() { global $ir; echo <<<EOF <html> <head> <title>Rage-Mafia</title> <style> body { font-family:helvetica, arial, geneva, sans-serif;font-size:12;color: #666000; scrollbar-base-color: #666000; scrollbar-arrow-color: #666000; scrollbar-DarkShadow-Color: #666000; } a:visited,a:active,a:hover,a:link { color: #666000;text-decoration: none; } table,tr,td { font-family:helvetica, arial, geneva, sans-serif;font-size: 12; } img { border:none; } textarea { font-family:helvetica, arial, geneva, sans-serif;font-size:12;color:#666000; } </style> </head> EOF; } function userdata($ir,$lv,$fm,$cm,$dosessh=1) { global $c,$userid; $ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; mysql_query("UPDATE users SET laston=unix_timestamp(),lastip='$ip' WHERE userid=$userid",$c); if(!$ir['email']) { die ("<body>Your account may be broken. Please mail [email][email protected][/email] stating your username and player ID."); } if($dosessh && $_SESSION['attacking']) { print "You lost all your EXP for running from the fight."; mysql_query("UPDATE users SET exp=0 WHERE userid=$userid",$c); $_SESSION['attacking']=0; } $enperc=(int) ($ir['energy']/$ir['maxenergy']*100); $wiperc=(int) ($ir['will']/$ir['maxwill']*100); $experc=(int) ( $ir['exp']/$ir['exp_needed']*100); $brperc=(int) ($ir['brave']/$ir['maxbrave']*100); $hpperc=(int) ($ir['hp']/$ir['maxhp']*100); $enopp=100-$enperc; $wiopp=100-$wiperc; $exopp=100-$experc; $bropp=100-$brperc; $hpopp=100-$hpperc; $d=""; $u=$ir['username']; if($ir['donatordays']) { $u = "<font color=red>{$ir['username']}</font>";$d="[img=donator.gif]"; } if($ir['gang']) { $qg=mysql_query("SELECT * FROM gangs WHERE gangID={$ir['gang']}",$c); $rr=mysql_fetch_array($qg); $gn=$rr['gangPREF'].""; } else { $gn=""; } print "<body bgcolor='black'> <table width=100%><tr><td>[img=logo.png]</td> <td>[b]Name:[/b] $gn{$u} [{$ir['userid']}] $d [b]Money:[/b] {$fm} [b]Level:[/b] {$ir['level']} [b]ReWard points:[/b] {$ir['crystals']} [[url='logout.php']Logout[/url]]</td><td> [b]Energy:[/b] {$enperc}% <img src=bargreen.gif width=$enperc height=10><img src=barred.gif width=$enopp height=10> [b]Will:[/b] {$wiperc}% <img src=bargreen.gif width=$wiperc height=10><img src=barred.gif width=$wiopp height=10> [b]Rage:[/b] {$ir['brave']}/{$ir['maxbrave']} <img src=bargreen.gif width=$brperc height=10><img src=barred.gif width=$bropp height=10> [b]EXP:[/b] {$experc}% <img src=bargreen.gif width=$experc height=10><img src=barred.gif width=$exopp height=10> [b]Health:[/b] {$hpperc}% <img src=bargreen.gif width=$hpperc height=10><img src=barred.gif width=$hpopp height=10></td></tr></table></div>[url='voting.php'][b]<center><u>Vote for Rage-Mafia on various gaming sites and be rewarded!</u></center>[/b][/url] [url='donator.php'][b]<center><u>Donate to Rage-Mafia, it's only \$3-30 and gets you a lot of benefits!</u></center>[/b][/url] "; $q=mysql_query("SELECT * FROM ads ORDER BY rand() LIMIT 1",$c); if(mysql_num_rows($q)) { } print "<table width=100%><tr><td width=20% valign='top'> "; if($ir['fedjail']) { $q=mysql_query("SELECT * FROM fedjail WHERE fed_userid=$userid",$c); $r=mysql_fetch_array($q); die("[b]<font color=red size=+1>You have been put in the Rage-Mafia Federal Jail for {$r['fed_days']} day(s). Reason: {$r['fed_reason']}</font>[/b]</body></html>"); } if(file_exists('ipbans/'.$ip)) { die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>"); } } function menuarea() { include "mainmenu.php"; global $ir,$c; print "</td><td valign='top'> "; } function endpage() { print "</td></tr></table></body> </html>"; } } ?> Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 25, 2010 Share Posted August 25, 2010 OK first. $ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'] Only need REMOTE_ADDR really. Try helping your querys. So add in an OR DIE. Don't use <FONT>. It's deprecated. Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 if i get rid of that it says im banned Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 25, 2010 Share Posted August 25, 2010 Sorry. I pressed the SUBMIT button for some reason, lol. Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 carnt php code still learning :/ Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 25, 2010 Share Posted August 25, 2010 Well.. All fair do's.. But. Why are you owning a game, or building a game, if you can hardly take care of problems yourself. I think you need to spend more time on http://www.php.net & http://www.w3schools.com && http://www.mysql.com and then start working on your game. Anyway... $ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; Can become $ip = $_SERVER['REMOTE_ADDR']; $qg=mysql_query("SELECT * FROM gangs WHERE gangID={$ir['gang']}",$c); Can become $qg = mysql_query("SELECT * FROM `gangs` WHERE `gangID` = ".$ir['gang']." " , $c) or die('Mysql ERROR!'); Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 now saying Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\header.php on line 79 Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 25, 2010 Author Share Posted August 25, 2010 im not making the game im just testing around with it and if i like it im gna put it up i got my bro to help me owt any way hes just not here atm Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 26, 2010 Share Posted August 26, 2010 So could I ask you this.. If your brother knows what he's doing. Why can't you wait for your brother to come back? Despite if the game code and the game ITSELF turns out good, wouldn't make a good game. Quote Link to comment Share on other sites More sharing options...
DreamCoder Posted August 26, 2010 Author Share Posted August 26, 2010 but isnt this site about helping LOL my brother does help me he just fixes my error's when he gets time :D but as i said THIS SITE IS ABOUT HELPING OWT OTHER PEOPLE TOO! Quote Link to comment Share on other sites More sharing options...
Wazam Posted August 26, 2010 Share Posted August 26, 2010 Yes.. and my comment below, involving helping you, isn't me helping you? You cannot depend on us to keep helping you with errors, if you can't sort it out yourself, and don't really attempt to fix the error, then what's the point of learning? You have MCC to experiment on, use that. Unlike me, I have to try and do things without using CPanel or MCC, GRPG, etc.. I can't even download WAMP, mum won't let me download squat. :P Instead on trying to make mods on your game.. Go on W3Schools, and get back learning on HTML. Quote Link to comment 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.