heres my code :
Code: Select all
<?
// open database connection
$connection = mysql_connect("XXX","XXX","XXX") or die ("Unable to
connect!");
// select database
mysql_select_db("XXX") or die ("Unable to select database!");
// generate and execute query
$query = "SELECT artist,id FROM lyrics ORDER BY artist";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print title with links to edit and delete scripts
while($row = mysql_fetch_object($result))
{
?>
<tr width="694">
<td class=primary width="35" align=center height=1>
<img border=0 src=images/band.gif width=32 height=32></td>
<td class=primary width="480" height=1>
<p align=left><a href="artist.php?artist=<? echo $row->artist;?>"><? echo $row->artist; ?></a></td></tr>
<?
}
}
// if no records present
// display message
else
{
?>
DATABASE EMPTY
<?
}
// close connection
mysql_close($connection);
?>
also is there a way to display it so i have two colums in the page .. like :
A | D
B | E
C | F