Page 1 of 1

HTML question ( was: "MySQL help ")

Posted: Sat Sep 06, 2008 3:06 pm
by SystemFailure
Moved from MySQL. This is stricly an HTML question.
My code:

Code: Select all

<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("fof") or die(mysql_error());
$Song = mysql_query("SELECT * FROM `songs` WHERE `Artist` LIKE CONVERT( _utf8 '%$Artist2%' USING latin1 ) COLLATE latin1_swedish_ci AND `Album` LIKE CONVERT( _utf8 '%$Album2%' USING latin1 ) COLLATE latin1_swedish_ci") or die(mysql_error());  
while($row = mysql_fetch_array( $Song )) {
$Artist2 = $row['Artist'];
$Album2 = $row['Album'];
echo"   <table border='1' cellspacing='0' cellpadding='0'>";
echo"   <tr><th colspan='2'>";
echo $row['Artist'];
echo"   </th></tr>";
echo"   <tr>";
echo"   <td valign='top' style='text-align: center; width: 160px; padding-top: 10px; padding-bottom: 10px;'>";
echo"   <div style='padding: 8px; font: 12px arial; font-weight: bold;'>";
echo $row['Album'];
echo"   <br />";
echo $row['Artist'];
echo"   </div>";
echo"   </td>";
echo"   <td valign='top'>";
echo"   <table border='1' style='width: 100%; margin-top: 10px; margin-bottom: 10px;' cellpadding='0' cellspacing='0'>";
echo"   <tr>";
echo"   <td width='8' style='font-weight: bold;text-align: right; width: 6px;'>";
echo $row['TRACK'];
echo"   </td>";
echo"   <td width='96'>";
echo $row['Song'];
echo"   </td>";
echo"   <td width='46' style=' border-left: 1px #cccccc solid; width: 40px;'>";
echo $row['TIME'];
echo"   </td>";
echo"   </tr>";
echo"   </table>";
echo"   </td>";
echo"   </tr>";
echo"   </table>"; 
}
?>
It out puts Somthing that looks like this... what i need help with is explained in the pic:
Image

Re: HTML question ( was: "MySQL help ")

Posted: Sun Sep 07, 2008 4:47 am
by jaoudestudios
How is this a HTML question? Did you read it?

System failure is enquiring about GROUP_CONCAT sounds like SQL to me? :wink:

I am not sure on your database structure but it sounds like you need to use a GROUP_CONCAT to get the album to only appear once at the top.