I was messing around with the output echo that gave the results of the query trying to figure out how to make the dog breed bold and now I am getting this
-Parse error: parse error in /Library/WebServer/Documents/dogs.php on line 22
I am pulling my hair out on this, if anyone can help with either the parse error or how to make the dog breeds bold I would be in your debt.
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT b.dogbreed ,(SELECT GROUP_CONCAT(DogName) FROM Names WHERE dogId=b.dogId ) as Dognames from breeds b";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo . $row["dogbreed"]. " - " . $row["Dognames"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</html>
echo . $row["dogbreed"]. " - " . $row["Dognames"]. "<br>";
Take out the . after echo:
echo $row["dogbreed"] . " - " . $row["Dognames"] . "<br>";
The tag you would be looking for in html to make it bold is this:
<strong>Text</strong>
Otherwise, if you could include more of your code and the lines, it would be of better help with the current error.
To make any text bold in echo
, simply add echo "<strong>" . $row ["dogbreed"] . "</strong>"
.
This way you can make any part of text bold.