My version of a connect script looks like.
<?
$conn=mysql_connect(localhost, $username, $pass);
if(!$conn)
{
echo mysql_error();
exit;
}
$dbname=mysql_select_db("user", $conn);
if(!$dbname)
{
echo mysql_error();
exit;
}
$query="select * from table where id like '".$id."';";
$result=mysql_query($query, $conn);
if ( !$result )
{
echo mysql_error();
exit;
}
$fields=mysql_fetch_array($result);
?>
After this lot $fields hold an array of the first row of fields from the database.
Try this and see what happens.
Mark.