title: Raspberry Pi output to a PHP webpage
body: <p>Hi i have been tasked to do a online counter using passive infrared sensor and a Raspberry PI. I need to be able to post the count on a webpage page which i had to create on my own.However, i am unable to get the counter output which i had coded in python to my webpage page. </p>
  
  <p>I have tried using count(output),exec() and shell_exec() and it did not work.</p>
  
  <p>Is it possible not to try to use flask? As i am very new to webpage designing and python.</p>
  
  <p>I am not very good in coding python or php.</p>
  
  <p>These is the python codes i have written</p>
  
  <pre><code>import RPi.GPIO as GPIO #1
  
  import math
  
  import os
  
  import threading
  
  import subprocess 
  
  import time
  
  import os.path
  
  import MySQLdb
  
  db = MySQLdb.connect(host="localhost", user="root", passwd="brandon", 
  db="menagerie")
  cur =db.cursor()
  GPIO.setmode(GPIO.BOARD)
  
  GPIO.setup(12,GPIO.IN)
  GPIO.setup(11,GPIO.IN) #16
  
  peoplecount=0   #18
  while(1):
  
  
  
   if GPIO.input(12):
   time.sleep(2)
   peoplecount = peoplecount+1
   time.sleep(1.5)
   cur.execute("INSERT INTO people(vistor,Date) VALUES(1,now())")
   db.commit()
   print peoplecount
   print "hello" #30 
  
   if(peoplecount &lt; 1):
   peoplecount=0  
  
   elif GPIO.input(11):
   time.sleep(2)
   peoplecount = peoplecount-1
   time.sleep(1.5)
   print peoplecount
   print "come back again"
  
  
  conn.commit()        
  cur.close()
  </code></pre>
  
  <p>These are my webpage codes :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
  table,th,td {
  border:1px solid black;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php
  
  echo "welcome to PI LAB&lt;br&gt;";
  echo date ('y-m-d H:i:s');
  
  $conn = new mysqli("localhost","root","brandon","menagerie");
  
  if($conn-&gt;connect_error)
  { 
  die("connection failed:" . $conn-&gt;connect_error);
  }
  
  $sql = "SELECT * FROM people";
  $result = $conn-&gt;query($sql);
  if ($result-&gt;num_rows &gt; 0) {
  echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;Vistor&lt;/th&gt;&lt;th&gt;Entry&lt;/th&gt;&lt;/tr&gt;";
  while($row = $result-&gt;fetch_assoc()) {
      echo "&lt;tr&gt;&lt;td&gt;" . $row["vistor"]. " &lt;/td&gt;&lt;td&gt; " . $row["Date"]. "&lt;/td&gt;
  &lt;/tr&gt;";
  }
  echo"&lt;/table&gt;";
  }
  $conn-&gt;close();
  
  ?&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>