I am getting data of Mysql table perfectly.
But the str_replace() function is not working for only special characters for mysql results only.
Example:
This is my datatable table.
|----|-------------------------------------|
|id | bodytext |
|----|-------------------------------------|
|100 | This is “test” this is normal text. |
|101 | This is “test” this is normal text. |
|102 | This is “test” this is normal text. |
|----|-------------------------------------|
Here is my code :
// Database connection
mysql_connect("localhost", "root", "test") or die(mysql_error());
mysql_select_db("mydb") or die(mysql_error());
// getting menu list
$mainmenuquery = "SELECT * FROM datatable WHERE id=100";
$mainmenuresult = mysql_query($mainmenuquery) or die(mysql_error());
while($mainmenurow = mysql_fetch_array($mainmenuresult, MYSQL_ASSOC)) {
$introtext = str_replace('”','_',$mainmenurow['bodytext']); // this is not working
$introtext = str_replace('“','_',$introtext); // this is also not working
print $introtext;
The output of above is perfect but the str_replace() function is not working at all.
I am getting this :
This is “test” this is normal text
But I want to get this :
This is _test_ this is normal text