• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Following SQL tutorial – server returning schema

Q&A Forum › Following SQL tutorial – server returning schema
0 Vote Up Vote Down
Paul French asked 4 years ago

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>

 

Question Tags: SQL
15 Answers
0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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.

0 Vote Up Vote Down
Paul French answered 4 years ago

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.

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
Paul French answered 4 years ago

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

0 Vote Up Vote Down
Paul French answered 4 years ago

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.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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?

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

Oh, one other thing. DO you have something like “View Source” in your browser? If so, what does that show?

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I thought that might be the case too but if it was then you would see some of the PHP code as well.

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

Exactly, but I’ve also never experienced that behavior. I think it’s something weird with the hosting or a configuration missing. 

0 Vote Up Vote Down
Paul French answered 4 years ago

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

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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();
?>
0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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 "&lt;")

Are you using Filezilla? If so, try changing transfer type to ASCII (From binary) and mode to passive (from active).

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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.

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

As Steve suggested, this error is due to your server configuration… It’s not related to your database. I would contact your hosting provider support and ask them why it’s not running PHP properly in that URL, they might be able to quickly help you

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.