Reputation: 4349
I'm only receiving data from the first table social_members
and not the two other tables _meminfo
and _memtext
. both tables have data in them with the same m_id
value that is in _meminfo
and _memtext
.
$res = mysql_query("SELECT sm.*, 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_pos']; // test from social_meminfo
Upvotes: 0
Views: 60
Reputation: 2645
You need to mention social_meminfo and social_memtext columns in your SELECT clause.
try this
SELECT * from .....
Upvotes: 1
Reputation: 2777
in your query you explicitly say that you only want data from the social_members table.
SELECT sm.* ....
has that effect (sm.* = all the columns from the table aliased as sm). if you want all the columns generated by your query, then you should instead do
SELECT * ....
Upvotes: 2