Hey guys,
--I'm asking this on a couple of forums, praying for some help!! --
I'm using Dolphin open script smart community builder and did a lot of customizing to it, but one thing I'm trying has had me stuck for over a week now (because I'm a PHP noob). I want to pull the member's primary photo from our database and use it as their music thumbnail. Currently it's just a simple default global thumbnail that's called upon in a simple URL request. I've already set up a string to each members profile image URL and did multiple inner joins in a sqlQuery which i believe is executed right because i asked for a error if there was a issue and now I don't receive any but when I look for the thumbnail nothing shows up. Here's the pieces of the code:
///this apiece in one function that the music FILES are defined in a array:
case 'music':
$this->sPrLinkPar = 'permalinks_gallery_music';
$sAddPath = 'ray/modules/music/files/';
$this->sFilesPath = BX_DIRECTORY_PATH_ROOT . $sAddPath;
$this->sFilesUrl = $this->aConfigSite['url'] . $sAddPath;
$this->sThumbUrl = $this->aConfigSite['profileImage']; //I added
$this->sMainTable = 'RayMusicFiles';
$this->sViewActionName = ACTION_ID_VIEW_GALLERY_MUSIC;
$this->aTableFields = array(
'medID' => 'ID',
'medProfId'=> 'Owner',
'medPhoto' => 'med_id',// I added
'medTitle' => 'Title',
'medUri' => 'Uri',
'medDesc' => 'Description',
'medTags' => 'Tags',
'medDate' => 'Date',
'medViews' => 'Listens',
'Approved' => 'Approved'
);
break;
////here's the piece in another function where i try to connect to the database and display the image (i took out my db info for security reasons):
case 'music':
$con = mysql_connect("localhost","host","pswrd");
if (!$con)
{
die('Could not connect, D: ' . mysql_error());
}
mysql_select_db("db_name", $con);
$result = mysql_query("SELECT media.{$this->aTableFields['medPhoto']}
FROM ((media INNER JOIN Profiles AS P ON P.ID = media.med_prof_id)
INNER JOIN {$this->sMainTable} AS Ray ON Ray.{$this->aTableFields['medProfId']} = media.med_prof_id)
INNER JOIN media AS thumb ON thumb.med_id = P.PrimPhoto
WHERE thumb.med_file = {$this->aTableFields['medProfId']}
");
if (!$result)
{
die('U F*d Up Somewhere, D: ' . mysql_error());
}
$sPhoto = $result;
if ($aFile['medCount'] - 1 > 0) {
$sImage = '<div class="lastFilesPic"><a href="'.$sHref.'"><img src="'.$this->sThumbUrl.$aData['medProfId'].'/thumb_'.$sPhoto['medProfId'].'"></a></div>';
}
break;
EDIT NOTE: Sorry I forgot to add :
'media' table is where the members images(med_file) are stored. Each image is named like 13769123687122.jpg or something and is identified by ID('med_id')
'Profiles' of course is the table of the members ID's('ID') and primary photo ID's('PrimPhoto') etc.
{$this->sMainTable} is the table 'RayMusicFiles' which is where the members music info is stored along with their member ID's({$this->aTableFields['medProfId']})
Any help will be GREATLY appreciated. This one little thing has been wreckin' my brain the past week :banghead: and I searched and searched online through Google and other resources like w3schools and though I've came a lot closer than before (the first little codes i tried to put together were HILARIOUS) I still can't afford the time to continue to dance in circles around this issue.
Please help!!