I’m having problems using mysql_fetch_field(), more to the point it’s returning nothing. The mysql_fetch_assoc() works fine. Is there something I need to set in MySQL in order to use mysql_fetch_field()?
[php]
$conn = mysql_connect( $host, $user, $password );
mysql_select_db( $database, $conn ) or die(mysql_error());
$sql = “SELECT artist, album FROM music”;
$result = mysql_query( $sql, $conn ) or die(mysql_error());
//while( $field = mysql_fetch_assoc( $result ))
while( $field = mysql_fetch_field( $result ))
{
print “<tr style=“background-color: white”>”;
//print “
//print “
if( isset( $field->artist )) {
print “
} else {
print "
}
if( isset( $field->album )) {
print “
} else {
print "
}
//print “
//print “
print “”;
}
[/php]