Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8357231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:24:59+00:00 2026-06-09T10:24:59+00:00

Well I have gotten this query: $characterinfoquery = SELECT c.Name, c.Level, c.Sex, c.Playtime, c.KillCount,

  • 0

Well I have gotten this query:

$characterinfoquery = "
SELECT 
    c.Name, 
    c.Level, 
    c.Sex, 
    c.Playtime, 
    c.KillCount, 
    c.DeathCount,
    cl.Name AS clanName
FROM 
    Character AS c, 
    Account AS a,
    ClanMember AS cm,
    Clan AS cl
WHERE 
    c.AccountID = a.AccountID AND
    c.CharacterID = cm.CharacterID AND
    cm.ClanID = cl.ClanID AND
    a.UserID='".mssql_real_escape_string($_SESSION['username'])."'
";

But I want the members who do not have a clan to be showed too but instead of the clan name it would say “-” at where the clan name is supposed to be.

This is my while statement:

if(mssql_num_rows($characterinforesult) != 0){
    $content = str_replace("%content%", file_get_contents("tpl/contents/characterinfo.html"), $content);

    //Get character information
    $search = array("%Name%", "%Level%", "%Sex%", "%Playtime%", "%KillDeath%", "%Clan%");
    $rows = file_get_contents("tpl/contents/characterinfo_tr.html");
    while($row = mssql_fetch_assoc($characterinforesult)){

        if($row['KillCount'] != 0){
            $KillDeath = round($row['KillCount']/$row['DeathCount'], 2);
        }
        else{
            $KillDeath = "-";
        }
        $Playtime = $row['Playtime']/60;
        $replace = array($row['Name'], $row['Level'], gender($row['Sex']), round($Playtime), $KillDeath, $row['clanName']);
        $tr .= str_replace($search, $replace, $rows);
    }
}

Could someone help me with this?

Output with innerjoins:

Name    Level   Sex     Playtime    K/D Ratio   Clan
DragonDex   97  Male    375 min     0.22            Test

It shows 1 row while there are 2 characters in that account, 1 has a clan the other doesn’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:25:00+00:00Added an answer on June 9, 2026 at 10:25 am

    Do you need a left outer join:

    SELECT 
        c.Name, 
        c.Level, 
        c.Sex, 
        c.Playtime, 
        c.KillCount, 
        c.DeathCount,
        coalesce( cl.Name, ' - ' ) AS clanName
    FROM 
        Character AS c 
              inner join  
        Account AS a 
              on c.AccountID = a.AccountID
              left outer join 
        ClanMember AS cm 
              on c.CharacterID = cm.CharacterID
              left outer join 
        Clan AS cl
              on cm.ClanID = cl.ClanID
    WHERE 
        a.UserID='".mssq ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

well i have a configuration like this in the components part of my config
Well i have a div tag that i show as a modal dialog this
I've spent two days on this and have gotten nowhere. I'm trying to use
UPDATE So I am still messing with this, and have gotten as far as
I have gotten this to work nicely, but when speed hits a certain speed
I realise this question has been asked before however the previous answers have gotten
This is an off the wall question but I have always gotten great support
Well i have a web page hosted in a IIS 7.0 now the problem
well I have that problem, im using a lightbox srcipt and im opening an
Well i have a form in site where people submit domains to my database,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.