By Fagault Eric on Monday, 30 January 2017
Posted in General Issues
Replies 1
Likes 0
Views 127
Votes 0
Hello,
I try to use a variable "$ user = $ this-> html ('html.user', $ target);" (The answer is "eric")
This variable displays the username of the member concerned.
But when I want to use this variable in a php, it is not seen.
So to test, I wrote the hard varaible: "$ user =" eric ";" And there my php works.

Do you know why ?

Best regards.
Eric

<?php
// Username de l'ami
$utilisateur = $this->html('html.user', $target); //(Returns "eric")
//$utilisateur = "eric"; // pour test

//ID de l'ami
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName('id'));
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('username') . ' = '. $db->quote($utilisateur));
/$db->setQuery($query);
$results = $db->loadResult();

// echo $results;
?>
You need to pass in the correct ID. In this case, it's most likely that your variable $target has an invalid value.
·
Monday, 30 January 2017 13:06
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post