Help outputing record for logged in user ASAP!

Hey I need some help with this bit of code it for PHP

So you visit the site and are logged in the code for your startpage is supposed to show you only your own latest activity, favorite, likes etc.. But for some reason I cannot get it to single out the logged in user, only everybody else. I did not write this code, but it is the only thing I have to work with.

// I added this bit to get the user info
// Get USER info
$user = JFactory::getUser();
$email = $user->email;

// This section joins to tables to display the complete record
// build the SQL query
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select ('com.article_id,, com.publish_date, com.published,, con.title, con.images');

// From the comments table
$query->from('#__joocomments as com');

// From the contents table
$query->from('#__content as con');

// Declaration to select to comment

// Select only the comments from the logged in user,
// But It never works no matter how I format it.
// I have been trying for months! Please tell me what I am doing wrong..

//Ordering the comments
$query->order('publish_date desc limit 20');

// Reset the query using our new query object


// Load the results as a list of stdClass objects.

	$rows = $db->loadObjectList(); 	

// Retrieve each value in the ObjectList


dunno much about php, but are you not replacing the WHERE condition with the three



Also this is a T-SQL (Microsoft SQL Server) forum. It looks like you may be using MySql

Is there a difference? Sorry Not familiar with that. though this was the right place to post the question. this sql stuff is all trial and error for me.

lots of differences, large and small!

e.g. SQL Server does not have a 'LIMIT' clause (uses TOP or OFFSET/FETCH instead)