Forums

Profile Page - Data from 2 DB Columns

blugreen 16 Dec, 2009
Hi.

A newby at the plugins and couldn't find what I was after in the forum partly because I wasn't sure what to search for.

I have a very basic form that I only available to registered members that I want to self populate with their firstname, lastname, username, email address, suburb and city. I can get the firstname, lastname, suburb and city to work fine using the data from the jos_comprofiler column.

It seems that the username and email address are stored in a seperate column. Is there any way of achieveing this.

TIA.

Mark
GreyHead 16 Dec, 2009
Hi Mark,

Yes - you will need to use a JOIN in the MySQL query that you use to get the data. I'm not certain of the syntax or the correct column nmaes without looking it up but it will be something like this:
$query = "
SELECT c.*, u.`username`, u.`email`
  FROM `#__comprofiler` AS c
  LEFT JOIN `#__users` AS u ON c.`user_id` = u.`user_id` ;
  WHERE . . . 
";

Bob
This topic is locked and no more replies can be posted.