Insert degree symbol into database via PHP

Hi friends StackOverflow,

I store the temperature in my database, but I cannot add a degree symbol. My code is:

$que = "Insert into tblTempForecast (DateTimePosted, Now, Tomorrow) VALUES(now(),'$CloseLow1 ° - $CloseHi1 °','$CloseLow2 ° - $CloseHi2 °')";
$insertTemp = mysql_query($que);

My $CloseLow1is 15, and $CloseHi120. $CloseLow2is 18, and $CloseHi222.

However, with my code above, it only inserts $CloseLow1and tags CloseLow2. It is supposed to insert ff into the database:

ID (auto)              DateTimePosted             Now            Tomorrow
1                      2013-11-18 15:25:48       15°-20°         18°-22°
+4
source share
1 answer
  • Do not use mysql_ * functions because they are deprecated. Learn about PDO instead, this is a way to do something nowadays.
  • HTML. UTF-8 ( , UTF-8 ).
  • UTF-8, . , htmlentities htmlspecialchars .
  • , 4 ? ( , ), ° script, DB.

, , , , , .

, 4. , , .

+10

All Articles