Jump to content

bimaljr

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bimaljr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
  2. here is my code : The first code before <hr> tag is working and the str_replace is also working perfectly. But when I fatch the same data from database and apply the str_replace command than it does not work. My "datatable" table contains the the same test as $data variable contains. But still not working. Please help me with this. Thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.