I am getting the following error:

"PHP Notice: Use of undefined constant localhost - assumed 'localhost' in /var/www/file.php"

The line number I am getting is the first line of code below.

========= PHP CODE ================
@mysql_select_db($database) or die( "Unable to select database");

$query = "SELECT URL FROM $type WHERE RAND='$rand' LIMIT 1";
$result = mysql_query($query);

while($row = mysql_fetch_row($result))
return $row[0];

What needs to be done. Thanks in advance for any help.