Query user_id to album_id to match and get pass hidden field
Posted: Wed Mar 02, 2011 5:05 pm
Need to get the album_id, so I can pass it into URL for other pages to read.
I am using this function and two tables to match the session user with (user_id with album_id for that user)
if they have no Id return "Album_id=0"??
How would I finish the code to get the album_id to echo or print on any textfield or hidden field??
I am using this function and two tables to match the session user with (user_id with album_id for that user)
if they have no Id return "Album_id=0"??
How would I finish the code to get the album_id to echo or print on any textfield or hidden field??
Code: Select all
//function check_album_on($album_id){
if(!$album_id) return true; // everybody can add an album if is a registered /author user
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$query = 'SELECT user_id FROM #__muscol_albums WHERE id = ' . $album_id ;
$db->setQuery($query);
$album_creator = $db->loadResult();
if($album_creator == $user->id) return true;
else return false;
echo ".$album_id" or echo
}