Chris Carter wrote:
my code: <html> <body> <? $username="chris"; $password="carter"; $database="chris_phpb1"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM phpbb_banlist"; $result=mysql_query($query); if (!$result) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>Companyname</th>"; echo "<th>Contactname</th></tr>"; while (odbc_fetch_row($result)) { $compname=odbc_result($result,"CompanyName"); $conname=odbc_result($result,"ContactName"); echo "<tr><td>$compname</td>"; echo "<td>$conname</td></tr>"; }
Connecting using mysql_connect and then using odbc_fetch_row won't work - they are completely separate interfaces (apart from odbc not being supported on your server).
Try while ($row = mysql_fetch_assoc($result)) { $compname = $row['CompanyName']; } See http://www.php.net/mysql_fetch_assoc for more info. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php