我想做的是让我的 html/php 代码在表格中显示来 self 的 MySQL 的数据。
它只连接到数据库,但我想我在以下位置遇到错误:$resultt=$con->query("SELECT DisplayName, Kills, Deaths, Wins, Lost FROM TTPlayer");
因为当我执行它时,它总是将该代码显示为网页上的文本。同样在表格中,它显示了每个行方法及其变量
在此先感谢您的帮助!
代码:
http://pastebin.com/j1EDux5y
最佳答案
"It is a .html file, I will check on php5_module – ZachtheBoB 2 mins ago"
.html
文件扩展名不会解析 PHP 指令。
执行此操作需要 .php
扩展名,并确保已安装并正确配置网络服务器和 PHP。
如果在本地机器上,您需要像 http://localhost/file.php
而不是 file:///file.php
那样访问它>/p>
但是,如果您愿意,您可以通过 .htaccess
指示 Apache 将 .html
文件视为 PHP。
AddType application/x-httpd-php .html
如果您只打算在一个页面上包含 PHP,最好这样设置:
<Files yourpage.html>
AddType application/x-httpd-php .html
</Files>
如果您将 PHP 作为 CGI 运行
AddHandler application/x-httpd-php .html
如果在 GoDaddy 上
Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
关于php - $con->用PHP查询MySQL错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29514483/