Hi everybody
i need a help
im trying to call the email of user have write article from database.
in custom html/php i have put this
But the field display the email of user connected not the email of the user have created the article.
Somebody can help me?
Thanks in advance
i need a help
im trying to call the email of user have write article from database.
in custom html/php i have put this
<?php
$database =& JFactory::getDBO();
$query = "SELECT * FROM #__users c JOIN #__content u ON c.id = u.id";
$database->setQuery( $query );
$useremail = $database->loadObject();
echo $useremail->email;
?>
But the field display the email of user connected not the email of the user have created the article.
Somebody can help me?
Thanks in advance
Hi solfri,
Your MySQL query needs to be much more sepcific, at present it will return many, many records, not just a single email.
Bob
Your MySQL query needs to be much more sepcific, at present it will return many, many records, not just a single email.
Bob
Hi,
The query is very vague and the join condition is supposed to be wrong as well, If you know the article id then you should also use it:
Regards,
Max
The query is very vague and the join condition is supposed to be wrong as well, If you know the article id then you should also use it:
$query = "SELECT * FROM #__users AS u LEFT JOIN #__content AS c ON c.user_id = u.id WHERE c.id='ARTICLE_ID'";
Regards,
Max
This topic is locked and no more replies can be posted.