how to fetch mysql data with speacial characters in php code example
Example: how to fetch mysql data with speacial characters in php
$sql2 = "SELECT name,email,contact FROM tbl_leadads";
$result = mysqli_query($conn, $sql2);
if (mysqli_num_rows($result) > 0) {
echo "<table><thead><tr><th>NAME</th><th>EMAIL</th><th>CONTACT</th></tr></thead>";
while($row = mysqli_fetch_assoc($result)) {
echo "<tr><td>".htmlentities($row["name"])."</td><td>".$row["email"]."</td><td> ".htmlentities($row["contact"])."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
mysqli_close($conn);
echo htmlspecialchars($string);
or
echo htmlentities($string);