Skip to content

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>";
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        //echo htmlspecialchars($row["name"]); 
        echo "<tr><td>".htmlentities($row["name"])."</td><td>".$row["email"]."</td><td> ".htmlentities($row["contact"])."</td></tr>";
    echo "</table>";
  } else {
    echo "0 results";
#try this
echo htmlspecialchars($string);
echo htmlentities($string);
See also  Python code snippet - How to make my discord bot shut down with a command?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.