Created
September 11, 2014 19:38
-
-
Save Uriel29/df9d1055b053978bf14c to your computer and use it in GitHub Desktop.
Achar nome de usuário a partir do ID. Banco de dados do Joomla! Usamos isso no Seblod!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id_user = $cck->getValue('usuario');//recebe ID do usuário | |
// conexão com banco e consulta | |
$db = & JFactory::getDBO(); | |
$query = "SELECT username FROM #__users WHERE id = $id_user"; // verifica no banco | |
$db->setQuery($query); | |
$user_array = $db->loadObject(); | |
$nome = $user_array->username; /recebe username do array | |
?> | |
<?php echo $nome; ?> //print do resultado! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment