PHP Classes

How to deal with apostrophe's

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  How to deal with apostrophe's  
Subject:How to deal with apostrophe's
Summary:In simple terms how to deal with apostrophe issues
Date:2021-11-06 10:25:31
Update:2021-11-10 10:22:31

  1. How to deal with apostrophe's   Reply   Report abuse  
Picture of Rain Rain - 2021-11-06 21:22:02

Can someone explain me in simple terms how to deal with apostrophe issues within a select query php.


$sql = "SELECT * FROM $County WHERE `Townland`='$Townland'";

if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){

while($row = mysqli_fetch_array($result)){

echo '<table width="90%" border="0">';
echo '<tr>';
echo '<td width="18%">Townland</td>';
echo '<td width="">'.$row["Townland"].'</td>';
echo '</tr>';

echo '<tr>';
echo '<td width="18%">Qualifier</td>';
echo '<td width="">'.$row["Qualifier"].'</td>';
echo '</tr>';


} else{
echo "Nothing selected yet!";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);


I got this error message: ERROR: Could not able to execute SELECT * FROM Essex WHERE `Townland`='St. John's Court'. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Court, Kilmore Road'' at line 1

Thanks in advance,

There are 2 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.

Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.

For more information send a message to info at phpclasses dot org.