possibly moving access to sql and php
first attempt to list table with blanks in field names
ok on select but what about the echo !!
<html>
<head><title>MySQL Table List</title></head><body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "members";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT `membership no`, `first name`, surname FROM Members";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["membership no"]. " - Name: " . $row["first name"]. " " . $row["surname"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
first attempt to list table with blanks in field names
ok on select but what about the echo !!
<html>
<head><title>MySQL Table List</title></head><body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "members";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT `membership no`, `first name`, surname FROM Members";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["membership no"]. " - Name: " . $row["first name"]. " " . $row["surname"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>