by
304 14
2
6
2,042
2
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 8701st place
Created
Modified Jul 5, 2014
LanguageText
LicenseMIT_X11

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;"
src="https://www.snip2code.com/Embed/85582/PHP-to-read-the-robot-arm-MySql-and-to-r?startLine=0"></iframe>
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