trouble getting a field to show using a function
Posted: Sat Sep 26, 2009 2:41 am
I've got some image categories, and each one is represented by an image. I want the category name to appear above the image for each category. The code is only returning the number of the category, which is created by an array. I can't for the life of me figure out how to get it to just show the name of the category instead. Here's the code I'm using
The category name should show up right after where it says Category, right before $album[0] in the eb_albums() function. Could someone point me in the right direction, please!!!???
Thanks,
Scott
Code: Select all
function eb_album_title($id) {
$sql="SELECT album_title FROM eb_albums WHERE album_id=".$id;
$query=mysql_query($sql);
return mysql_result($query,0);
}
function eb_albums() {
global $lang;
$albums=eb_albums_array();
if(count($albums)>0) {
$output="\t\t<ul id=\"albums\">\r\n";
foreach($albums as $album) $output.="\t\t\t<P>Category $album[0]<P><a href=\"photos.php?album=".$album[0]."\"><img src=\"photos/category/".$album[0].".jpg\" alt=\"".$album[1]."\" /></a><P>\r\n";
$output.="\t\t</ul>\r\n";
}
else $output="";
return $output;
}The category name should show up right after where it says Category, right before $album[0] in the eb_albums() function. Could someone point me in the right direction, please!!!???
Thanks,
Scott