DELETE-ME-NOW- Posted September 6, 2010 Posted September 6, 2010 Im in need of a little noob help :) Im trying to make a gym memberships MOD for my game (First mod), and ive got everything nearly done, but then i come to the table part where to view the available gyms... None of the gyms are showing up even after i have added them to phpMyadmin Heres my table: echo" <table width='90%' cellspacing=1 class='table'><tr><th>Gym Name</th> <th>Cost Per Week</th> <th>Level</th> <th>Join</th></tr>"; while($r=$db->fetch_row($q)) { print "<tr><td align='center' colspan='5' class='h'> [b]{$r['gymgroupNAME']}[/b]</td></tr>"; foreach($crimes as $v) { if($v['gymGROUP'] == $r['gymgroupID']) { print "<tr> <td>{$v['gymNAME']}</td> <td>{$v['gymCOST']}</td> <td>{$v['gymLEVEL']}</td> <td><div class='perform_btn'>[url='joingym.php?c={$v[']Join[/url]</div></td> </tr>"; } } } print "</table>"; I know this is probably something simple, as im still a noob. Can someone please point ot to me where i am going wrong? Thanks! Quote
Matthew Posted September 6, 2010 Posted September 6, 2010 I had posted the code asking why " was after echo on first line but then i looked at it i was like why the heck did i just say that so i took off the post! Quote
rulerofzu Posted September 6, 2010 Posted September 6, 2010 If your going to ask for help with your code at least post all of the code. Quote
DELETE-ME-NOW- Posted September 6, 2010 Author Posted September 6, 2010 <?php include 'globals.php'; if($ir['donatordays'] < 1) { die('This is for donators only!'); } echo' Welcome to the gym membership hall! '; if($ir['gym'] > 1) { echo" You are currently a member of XXX gyms!"; } else { echo" You are not a member of any gym at the momment. Please join one of the gyms below!"; } echo" <table width='90%' cellspacing=1 class='table'><tr><th>Gym Name</th> <th>Cost Per Week</th> <th>Level</th> <th>Join</th></tr>"; while($r=$db->fetch_row($q)) { print "<tr><td align='center' colspan='5' class='h'> [b]{$r['gymgroupNAME']}[/b]</td></tr>"; foreach($crimes as $v) { if($v['gymGROUP'] == $r['gymgroupID']) { print "<tr> <td>{$v['gymNAME']}</td> <td>{$v['gymCOST']}</td> <td>{$v['gymLEVEL']}</td> <td><div class='perform_btn'>[url='joingym.php?c={$v[']Join[/url]</div></td> </tr>"; } } } print "</table>"; $h->endpage(); ?> Not really much too it the now lol... This code i just started :) Quote
Matthew Posted September 6, 2010 Posted September 6, 2010 I don't have my domain up anymore so I am trying to go on by not testing it why at line 9 its ' after echo and not " line 10 too. When you are trying this do you have donator days? You made it for only donator days poeple can look at it... if($ir['gym'] > 1) would be better if.. if($ir['donatordays'] < 1) ? Quote
rulerofzu Posted September 6, 2010 Posted September 6, 2010 See this line while($r=$db->fetch_row($q)) where is the query $q? Quote
Armageddon Posted September 6, 2010 Posted September 6, 2010 Some suggestions: Don't use DIE - Echo or Print is fine Clean Coding - Try and space words about || Along with echo" is deprecated - Use <span> || Or if you work around PHP with HTML, use Add some query's in :?: Quote
DELETE-ME-NOW- Posted September 6, 2010 Author Posted September 6, 2010 Thanks for the advice Armageddon. As ive never acualy used tables before, this code was referenced from my criminal.php file... So $q is prob something to do with crimes lol... Is that what is causing the table not to show properly? Quote
Armageddon Posted September 6, 2010 Posted September 6, 2010 No problem, and yes absolutely. Nothing is being selected from a/the DB, so the table won't know what is what, or were it is. Quote
Nickson Posted September 6, 2010 Posted September 6, 2010 check line 24 as well, a change is needed there as well .. foreach($crimes as $v) Quote
DELETE-ME-NOW- Posted September 6, 2010 Author Posted September 6, 2010 Lol. Im not sure how i didnt see that lol... So what would go instead of $q? Quote
corruptcity || skalman Posted September 6, 2010 Posted September 6, 2010 what i would do with if($ir['donatordays'] < 1) { die('This is for donators only!'); } change it to this if($ir['donatordays'] < 1) { echo"This is for donators only!"; $h->endpage(); exit; } that way it ends the header and stops the rest of the code 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.