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 7090801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:06:05+00:00 2026-05-28T08:06:05+00:00

This maybe the reason why I’m having problems in other areas, but which outputting

  • 0

This maybe the reason why I’m having problems in other areas, but which outputting the area its giving an empty result for m_id. the filed it used multiple times and is correctly displaying data for all the other fields but the main field m_id that is used is not showing its ID number.

$res = mysql_query("SELECT *, DATE_FORMAT(sm.m_lld,'%m/%d/%y') 
                    AS m_lld_formatted 
                    FROM social_members sm
                    JOIN social_meminfo smi ON (sm.m_id = smi.m_id)
                    LEFT OUTER JOIN social_memtext smt ON (sm.m_id = smt.m_id)
                    WHERE sm.m_user = '".mysql_real_escape_string($en['user'])."'");            
if (mysql_num_rows($res) == 0) call404();
$line = mysql_fetch_assoc($res);
foreach ($line as $key => $value) {
        $en['m'.$key] = str_replace("\n",'<br/>',stripslashes($value));
        }

echo '<pre>'; print_r($line); echo '</pre>';
echo $en['mm_id'];

Okay I think I see what’s happening. When I do a LEFT OUTER JOIN for social_memtext if that table finds no results for m_id it does not display a value for m_id even though its present in the other two tables. Is there anyway to fix that? m_id will always have a value/row in social_members and _meminfo when looked up

  • 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-05-28T08:06:05+00:00Added an answer on May 28, 2026 at 8:06 am

    From: http://php.net/manual/en/function.mysql-fetch-assoc.php

    If two or more columns of the result have the same field names, the last column will take precedence.

    You are selecting everything out of 3 joins and in every table m_id has the same name.
    Which means there are 3 m_id‘s in your resultset, last one being from the left joined table social_memtext, which will be NULL if there is no corresponding row in that table for given m_id.

    To get your expected m_id add an alias in SELECT and use that alias for array index in php.

    SELECT *, DATE_FORMAT(sm.m_lld,'%m/%d/%y') 
                    AS m_lld_formatted,
              sm.m_id as mem_id
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this maybe a very basic question but I'm having a bit of
This maybe a really simple question but for some reason my code isn't working.
This maybe a stupid question, but as I can not easily undo my change
I know this maybe a basic question but I just can't seem to find
Ok so this maybe a simple/silly question but I don't know so here goes:
This question maybe a better fit on The Business of Software forum but despite
Maybe this is a dumb question, but is there any way to convert a
Maybe this applied to other Delphi's (I've only used 7). We've got our code
Maybe this question is easy,but I can't understand now. String.prototype.self=function() { return this; }
Maybe this is a newbie question or RTFM question... but I couldn't find it

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.