Baevus
the names ethan
- Nov 4, 2012
- 565
- 47
This is what I want. I want to list all the usernames but it isn't working; Parse error: syntax error, unexpected T_STRING in /home/u523656928/public_html/Content/Scripts/membersmain.php on line 4. Is there a way to add a <?php tag in a <?php tag?
PHP:
<?php echo $_SESSION['id']?'Click on a members name to see their profile!<br/>
<?php include 'connect.php'
// Create connection
$conn = new sql($id, $username);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, username FROM Users";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<br> id: ". $row["id"]. " - Username: ". $row["username"]. "<br>;
}
} else {
echo "There are no users registered!";
}
$conn->close(); ?>':'<i>If you are seeing this you are NOT logged in! Please do so by clicking Log In | Register!</i>';?>