Mark F Posted June 13, 2008 Share Posted June 13, 2008 Hello Everyone, I wish to display the name of my gang on my index page. I know that I have to add the following: if($r['gang']) { print "[url='gangs.php?action=view&ID={$r[']{$r['gangNAME']}[/url]"; } else { print "N/A"; } Though how do I change the following code so I only have what I need?: include "globals.php"; $_GET['u'] = abs((int) $_GET['u']); if(!$_GET['u']) { print "Invalid use of file"; } else { $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN cities c ON u.location=c.cityid LEFT JOIN houses h ON u.maxwill=h.hWILL LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN fedjail f ON f.fed_userid=u.userid WHERE u.userid={$_GET['u']}"); Quote Link to comment Share on other sites More sharing options...
Mark F Posted June 13, 2008 Author Share Posted June 13, 2008 Re: Help with silly problem, displaying gangs name. or it might just be easier for me to ask How do I display peoples gang names on the index page, lol. Quote Link to comment Share on other sites More sharing options...
Halo Posted June 17, 2008 Share Posted June 17, 2008 Re: Display Gangs Name??? Add this to were the queries are: $wq=$db->query("SELECT * FROM gangwars where warDECLARER={$ir['gang']} or warDECLARED={$ir['gang']}"); $gq=$db->query("SELECT * FROM gangs WHERE gangID={$_GET['ID']}"); $gangdata=$db->fetch_row($gq); $gq=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangID={$ir['gang']}"); $gangdata=$db->fetch_row($gq); Then add somewhere in Index.php: if($ir['gang']) { print " <u>Gang Info</u> Your Gang: [url='gangs.php?action=view&ID={$ir[']<font color=green>{$ir['gangNAME']} ({$ir['gangID']})</font>[/url] Your Gang Wars: <font color=red>".$db->num_rows($wq)." Wars</font> Your Gang Respect: {$ir['gangRESPECT']} "; } else { print "<u>Gang Info</u> Your not in a gang "; } Just thought of it, might not work but its worth a shot Quote Link to comment Share on other sites More sharing options...
Mark F Posted August 16, 2008 Author Share Posted August 16, 2008 Re: Display Gangs Name??? I couldn't get it to work, I think that it had something to do with {$_GET['ID']} in the queries. Quote Link to comment Share on other sites More sharing options...
Tonka Posted August 16, 2008 Share Posted August 16, 2008 Re: Display Gangs Name??? here is what i use and it works fine $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.userid=$userid"); $g=$db->fetch_row($q); [b]Gang:[/b] "; if($g['gang']) { echo "[url='gangs.php?action=view&ID={$g[']{$g['gangNAME']}[/url] "; } else { echo "N/A "; } 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.