parent
993da418d8
commit
ab986afb77
|
@ -52,15 +52,11 @@ def register_tube(mac_address):
|
||||||
cur.execute("SELECT * FROM tubes WHERE mac_address = %s", (mac_address,))
|
cur.execute("SELECT * FROM tubes WHERE mac_address = %s", (mac_address,))
|
||||||
existing_tube = cur.fetchone()
|
existing_tube = cur.fetchone()
|
||||||
|
|
||||||
print(existing_tube)
|
|
||||||
|
|
||||||
# Check if the tube exsist. If it doesn't create a new db row
|
# Check if the tube exsist. If it doesn't create a new db row
|
||||||
if not existing_tube:
|
if not existing_tube:
|
||||||
cur.execute("INSERT INTO tubes (mac_address, universe, dmx_address) VALUES (%s, %s, %s)",
|
cur.execute("INSERT INTO tubes (mac_address, universe, dmx_address) VALUES (%s, %s, %s)",
|
||||||
(mac_address, 0, 1))
|
(mac_address, 0, 1))
|
||||||
print("executed")
|
|
||||||
else:
|
else:
|
||||||
print("already exists")
|
|
||||||
pass
|
pass
|
||||||
cur.close()
|
cur.close()
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
die("Connection failed: " . $conn->connect_error);
|
die("Connection failed: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
echo "Connected successfully";
|
echo "Connected successfully";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue