PDA

View Full Version : PHP Help :)



Moh
01-03-2008, 04:21 PM
Well for some reason, this wont fetch the hotel from the database :S

Heres the code.

<?php
$dbh=mysql_connect ("localhost", "habbcr_spotlight", "*********") or die
('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("habbcr_spotlight");
$sql = mysql_query("SELECT * FROM `habbos` ORDER BY RAND() LIMIT 1");
echo("<table cellpadding=\"0\" cellspacing=\"0\" width=\"105\" height=\"135\">");
while($fetch = mysql_fetch_array($sql))
$habbo = $fetch[habbo];
$hotel = $fetch[hotel];
{
if($hotel == "com")
{
$display = "(USA)";
}
if($hotel == "co.uk")
{
$display = "(UK)";
}
if($hotel == "ca")
{
$display = "(CA)";
}
if($hotel == "com.au")
{
$display = "(AU)";
}
if($habbo == "****" || $habbo == "****" || $habbo == "****" || $habbo == "*******" || $habbo == "******")
{
$habbo = "Bobba";
}
echo("<tr>
<td height=\"143\" width=\"105\">
<img border=\"0\" src=\"http://habbcrazy.net/spotlight/$hotel/$habbo\" width=\"105\" height=\"143\"></td>
</tr>
<tr>
<td><span style=\"font-size:11px;font-family: Verdana, Arial, Helvetica, sans-serif; font-color:#FFFFFF;font-weight:bold;\">$habbo $display</span></td>
</tr>");
}
echo("</table>");
?>And yes, I do have a hotel field, and yes it has infomation in.

Want to hide these adverts? Register an account for free!