Where if $user->id is not the user in url, then use the $userid from GET. in url.
Code: Select all
// Return with empty data
if ($user->id == null || empty($user->id)) {
//return false;
}
// Query the database for the user
$sql = 'SELECT * FROM jos_muscol_albums WHERE user_id = ' . $user->id;
} else if isset($_GET['userid']) ? (int)$_GET['userid'] : JRequest::getVar('userid');
// Query the database for the user
$sql = 'SELECT * FROM jos_muscol_albums WHERE user_id = ' . $_GET['userid'];
}
$result = mysql_query($sql) or die('Error, No Album Search failed');
//$result = mysql_query($sql) or die('Error, No Album Search failed<br />' . mysql_error());
if (mysql_num_rows($result) > 0) {
list($id, $year, $name) = mysql_fetch_array($result);
// Display the results
//echo $id . '<br />' . $user->id . '<br />' . $year;
//echo $name;