Snip2Code is shutting down.
It has been quite a ride, since 2013 when we launched our first prototype: thanks to the effort of you guys we collected more than 3 million snippets!
We are very proud to help all our users to be more efficient in their jobs, and to be the central point to share programming knowledge for everyone.
Our basic service is free, so we always survived on our own resources to give you Snip2Code.
Unfortunately, we are no more in the financial position to sustain this effort, and therefore we are announcing here our permanent shut down,
which will take place on August 1st, 2020.
Please save your private snippets using our backup function in the settings, here.
IF YOU WANT TO SAVE SNIP2CODE, PLEASE CONSIDER DOING A DONATION!
This will allow us to pay for the servers and the infrastructure. If you want to donate, Contact Us!
by
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;"
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