Internet of Things php code and stuff

First, THANK YOU guys, i'm learning python and IoT and your site is

I'm trying to develop a DIY project on my own where a python script runs on a RPI and sends data to update a MySQL database on a server. The project on the RPI is fine a working, but my problem is on the server side and I want to use my pythonanywhere account page.

In the following tutorial they do this with php:

...but I know you don't allow php in you site...ughhhh!

So the php code is in fact very simple:


// code to print out the temperature database in tabular form

$username="root"; $password="raspberry"; $database="templog"; $server="localhost"; mysql_connect($server,$username,$password); mysql_select_db($database);    $query="SELECT * FROM `temp-at-interrupt` ORDER BY `Date` DESC, `Time` DESC;";  $result=mysql_query($query);

?> <html>    <head>
      <title>Sensor Data</title>    </head> <body>    <h1>Temperature readings</h1>

   <table border="1" cellspacing="1" cellpadding="1">       <tr>            <td>&nbsp;Date&nbsp;</td>           <td>&nbsp;Time&nbsp;</td>           <td>&nbsp;Temperature&nbsp;</td>        </tr>

             while($row = mysql_fetch_array($result)) {
                printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td></tr>", 
                   $row["Date"], $row["Time"], $row["Temperature"]);

   </table> </body> </html>

I think this code print outs the temperature database in tabular form. Is there a way top do this in your site guys. What language/script should I use ?

The other thing is, how to update the MySQL database with data being sent from the RPI ? In the aforementioned tutorial they use Google site by the scheme known as GCM push notification for what they use php!...what can I do to stay in pythonanywhere ?

Thank you again and regards.

I think you'll probably want to find a different tutorial! Adapting PHP code from scratch to work in Python needs a bit of Python skills...

You could start with one of ours: -- it's not IoT specific but it does cover the basics of web apps and databases on pythonanwyhere...