I am following the tutorial to build a sql database “esp32-esp8266-mysql-database-php” and I got as far as creating the database on my website host, which does not use cPanel, so I had to work my way through a different UI. I got as far as showing an empty table in my browser, instead I get a view of the data schema [edit should read table structure]. Any idea what I may be doing wrong?
<!DOCTYPE html> <html><body> <table cellspacing="5" cellpadding="5"> <tr> <td>ID</td> <td>Sensor</td> <td>Location</td> <td>Value 1</td> <td>Value 2</td> <td>Value 3</td> <td>Timestamp</td> </tr> </table> </body> </html>
I believe I may be a little confused. Are you saying the HTML you posted is showing in the browser? What do you mean by “data schema”?
You may like to try with dummy data in the PHP file and see whether it populates the database table.
Hi Steve, I did confuse you, my apologies, I meant to say table structure. Currently I see this in my browser:-
Whereas the tutorial states that at this stage the browser should return an empty table.
Hello Paul, I assume that you are following this tutorial, right?
- ESP32/ESP8266 Insert Data into MySQL Database using PHP and Arduino IDE
https://randomnerdtutorials.com/esp32-esp8266-mysql-database-php/
Did you copy this exact content to your esp-data.php file? https://raw.githubusercontent.com/RuiSantosdotme/ESP32-ESP8266-PHP-MySQL/master/code/esp-data.php
Which hosting provider are you using?
Hi Rui,
Yes I am following your tutorial. My host provider is https://www.blacknight.com/web-hosting using their basis Minimus server plan, with no cPanel option. I have used ftp to upload the files. i believe I copied everything exactly, but getting a different response from my server. I will reload the file from github and see if this persists. Thank you, Paul
Ok, I have rechecked the file contents of esp-data.php and the only difference is that I had to replace server name
$servername = "localhost";
from local host to the ip address, as it wouldn’t work with localhost. I did this more out of trial and error rather than any explicit know how!
So the problem remains, why I am getting this result on my browser? Thanks for your help.
The only thing I can think of that would show that is that your browser is not HTML5 compliant. The DOCTYPE declaration would be wrong for HTML4 or below so it wouldn’t renders as HTML.
What OS are you using and browser/version?
Oh, one other thing. DO you have something like “View Source” in your browser? If so, what does that show?
I’m trying to understand what’s missing. I think your hosting provider is not running the PHP files properly or something. Can you contact them and tell them if that URL in your hosting account is running PHP properly?
I thought that might be the case too but if it was then you would see some of the PHP code as well.
Exactly, but I’ve also never experienced that behavior. I think it’s something weird with the hosting or a configuration missing.
Thank you Steve and Rui.
I checked the ViewSource on my Chrome Browser, but it returns exactly the same result – see following screenshot:-
I looked again at the host view of the SQL database and it looks fine, but maybe you can see your issues:-
and
PHPMyAdmin just looks at the MySQL database and is not related to your issue. Also, as you can see, the URL starts with cp.blacknight.com so is not even using your domain.
Can you try creating a file (call it phpinfo.php) with the following code and call it? What do you get?:
<?php
phpinfo();
?>
I looked at the support section of your hosting provider. Apparently there is a section at cp.blacknight.com called “Website Configuration”. Can you take screen shot(s) of that and post them?
I’m guessing you went with Linux web hosting. What type of computer do you use? Is it Windows? Clutching at straws here but perhaps line breaks are incorrect? Sometimes Linux boxes don’t like Windows line breaks. Your IDE or editor should have a setting to use Linux line breaks when saving the file.
About the only other guess I have is that something is changing the text to HTML entities
(ie. "<" is being changed to "<")
Are you using Filezilla? If so, try changing transfer type to ASCII (From binary) and mode to passive (from active).
If worse comes to worst you can create an admin account for one of us and give us the login details. Then we can check your configuration for you. Once done you can delete that account.