using url userid to match table user_id to get Ablum Id o ID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danjapro
Forum Commoner
Posts: 72
Joined: Mon Sep 27, 2004 10:56 am

using url userid to match table user_id to get Ablum Id o ID

Post by danjapro »

There is something wrong with my statement it is not returning sql queries results based on matching the url based based userid to match with the table user_id and get the Ablum id and Album name:

Results are die('Error, No Album Search failed'); How do I get the Id

Please hlep:

Code: Select all

		if(isset($_GET['userid']))
		{
		$db =& JFactory::getDBO();
		$user =& JFactory::getUser();
        $id = $user->id;

		
		$album_id = $_GET['userid'];
		$query = 'SELECT user_id, id, format_id, year, name FROM #__muscol_albums WHERE user_id = ' . $album_id;
		//$query = 'SELECT user_id FROM #__muscol_albums WHERE id = ' . $album_id ;
		$result = mysql_query($query) or die('Error, No Album Search failed');
		list($name, $user_id, $id, $year) = mysql_fetch_array($result);
		
	
		echo $id;
		
		//exit;
		}
Post Reply