From 191efa6677c34c3f4b0cff9d532b06ac99a27701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 01:36:10 +0100 Subject: [PATCH] testing db MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/web/index.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/server/web/index.php b/server/web/index.php index c62459d..67b5972 100644 --- a/server/web/index.php +++ b/server/web/index.php @@ -25,16 +25,27 @@ $server = "localhost"; $username = "pxm"; $password = "pixel"; + $db_name = "pixeltube_db" - $conn = new mysqli($server, $username, $password) + $conn = new mysqli($server, $username, $password, $db_name) if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; - - ?> + $sql_query = "SELECT id, mac_address, universe, dmx_address FROM tubes"; + $result = $conn->query($sql); + + if ($result->num_rows > 0) { + // output data of each row + while($row = $result->fetch_assoc()) { + echo "id: " . $row["id"]. " - Mac: " . $row["mac_address"]. " " . $row["universe"]. " ". $row["dmx_address"]. "
"; + } + } + else { + echo "0 results"; + } ?>