MySQL
服务器:mysql.mysite.com 通过 TCP/IP 服务器版本:5.1.56-log 协议版本:10 用户:username@__.dreamhost.com MySQL 字符集:UTF-8 Unicode (utf8)
网络服务器
Apache MySQL 客户端版本:5.1.66 PHP 扩展:mysql
phpMyAdmin
版本信息:3.3.10.4
我现在不知所措。确切的代码目前正在实时站点上运行,但不适用于我正在设计的新站点。
<table>
<tr bgcolor="#CCCCCC">
<th>###</th>
<th>Year</th>
<th>Make</th>
<th>Model</th>
<th>Description</th>
<th>Mileage</th>
<th>Price</th>
</tr>
<?
$host = "mysql.mysite.com";
$user = "username";
$pass = "password";
$dbname = "database";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
$sql = "SELECT * FROM vehicles WHERE sold='n' ORDER BY year DESC";
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)) {
echo "<tr>
<td></td>
<td>",$row['year'],"</td>
<td>",$row['make'],"</td>
<td>",$row['model'],"</td>
<td>",$row['dscrpt'],"</td>
<td>",$row['miles'],"</td>
<td>",'$',$row['price'],"</td>
</tr>";
}
?>
</table>
我在站点上收到以下结果,本地和加载到服务器上时:
"); mysql_select_db($dbname); $sql = "SELECT * FROM vehicle WHERE sold='n' ORDER BY year DESC"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) {回声“”;}?>
年份 品牌 型号 描述 里程价格 ",$row['year']," ",$row['make']," ",$row['model']," ",$row['dscrpt']," ",$row['miles']," ",'$',$row['price'],"
我尝试了其他一些方法,包括 mysqli 方法,但它们都产生了相同的结果。任何连接都没有改变,当前连接/网页仍然返回数据。我会疯狂地查看代码并使用具有相同结果的不同代码。