Welcome, Guest
Username Password: Remember me
  • Page:
  • 1

TOPIC: userid

userid 5 years, 2 months ago #66

  • mwp
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Hello,
Can a userid be used in the query?
How can i do that?
Thnx

Re: userid 5 years, 2 months ago #67

  • kaysten
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
The DB Query Module only allows you to use SQL statements to output the results in the module. If you know a specific user's id and you will want to write a query for every one to see that output then you can write the following query:

SELECT * FROM `jos_users` WHERE id='62';


But if you want to write a query to show the logged in user's information and dynamically write a query based on the currently logged in user's id, then the module will not support that. So if this is the desired functionality you seek then you can try using a PHP code module in which you can write PHP and then write something such as:

$db = JFactory::getDBO();
$user =& JFactory::getUser();
$sql = 'SELECT * FROM `jos_users` WHERE id='.$db->quote($user->id);
$db->setQuery($query);
$data = $db->loadObject();
  • Page:
  • 1
Time to create page: 0.28 seconds