304 14

PHP to read the robot arm MySql and to run the arm Python Script

Reads arm table and can pass the data to Python
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<?php // Create Connection $con=mysqli_connect("localhost","my_name","my_password","action"); //Check connection if (mysqli_connect_errno()) { echo "failed to connect to mysql: " . mysqli_connect_error(); } // escape variables for security $id = mysqli_real_escape_string($con, $_POST['id']); $duration = mysqli_real_escape_string($con, $_POST['duration']); $direction = mysqli_real_escape_string($con, $_POST['direction']); $status = mysqli_real_escape_string($con, $_POST['status']); $result = mysqli_query($con,"SELECT * FROM arm where status='0'"); echo "<table border='1'> <tr> <th>_Id_</th> <th>Duration</th> <th>Direction</th> <th>Status</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['duration'] . "</td>"; echo "<td>" . $row['direction'] . "</td>"; echo "<td>" . $row['status'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> <htlm> <form action="/cgi-bin/run_mymove.php" method="get"> Run:<input type="hidden" name="run"> <input type="submit"> </form> </html>
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus