Jump to content
MakeWebGames

Recommended Posts

Posted

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']}");
Posted

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.

Posted

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

  • 1 month later...
Posted

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
";
}

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.   Paste as plain text instead

  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...