Problem with connection to different DB
Posted: Tue Jun 12, 2007 7:18 pm
this is the first time ive done this- connect to a different DB on a server.
It didnt turn out so well. none of the info is displaying, only saying "there are no users". what did i do wrong?
feel free to laugh, i know this is a stupid problem but please help
It didnt turn out so well. none of the info is displaying, only saying "there are no users". what did i do wrong?
Code: Select all
<?
$link = mysql_connect('mysql14.powweb.com', 'aa', 'aa');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('a100');
if (!$db_selected) {
die('Could not select database: ' . mysql_error());
}
$query = 'SELECT username, ostatus FROM users';
$result = mysql_query($query);
if (!$result) {
die('Query failed: ' . mysql_error());
}
mysql_free_result($result);
?>
<tr bgcolor="#<?= ($i%2) ? 'FFE5B7' : 'FFEECC' ?>">
<Td>
<? echo $r["username"]; ?></Td>
<Td>
<? echo $r["ostatus"]; ?></Td>
<?
if($i==0)
{
?>
<tr>
<Td colspan=4 align="center"><FONT SIZE="2" COLOR="#FF0000"><B>No Users Reported</B></FONT></Td>
</tr>
<? } ?>