-1

What I'm trying to do is get my html/php code to display data from my MySQL in a table.
It connects just find to the database, but I think I'm getting an error at: $resultt=$con->query("SELECT DisplayName, Kills, Deaths, Wins, Lost FROM TTPlayer"); for it always shows that code as text on the webpage when I execute it. Also in the tables it shows each of the row methods and their variable

Thanks in advance for any help!

Code: http://pastebin.com/j1EDux5y

Executed webpage: http://pasteboard.co/2pzqESnw.png

ZachtheBoB
  • 188
  • 2
  • 9

1 Answers1

2

"It is a .html file, I will check on php5_module – ZachtheBoB 2 mins ago"

.html file extensions will not parse PHP directives.

A .php extension is required to do this, plus making sure a webserver and PHP are installed and properly configured.

If on a local machine, you will need to access it like http://localhost/file.php and not file:///file.php

You can however, instruct Apache to treat .html files as PHP through .htaccess if that is your preference.

AddType application/x-httpd-php .html

If you only plan on including the PHP on one page, it is better to setup this way:

<Files yourpage.html>
AddType application/x-httpd-php .html
</Files>

If you are running PHP as CGI

AddHandler application/x-httpd-php .html

If on GoDaddy

Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
Funk Forty Niner
  • 73,764
  • 15
  • 63
  • 131