Tagged: php

Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in WordPress

Problem: When trying to import RSS via a built-in plugin, there is an error occurred Call to undefined function set_magic_quotes_runtime()

If you are using PHP 5.3 or after, set_magic_quotes_runtime() is already deprecated, although it will not cause a Fatal error it will send an E_DEPRECATED warning.

Solution: Remove all set_magic_quotes_runtime() in the WordPress project

Want to remove useless 0 digits from number

Problem: sometimes website is having a number with .0 or .00 but it is useless and waste of space.

Solution: use floatval Laravel or PHP based Language; use parseFloat() in Javascript, for example:

echo  floatval(10.50); // 10.5
echo  floatval(10); // 10
echo  floatval(10.00); // 10
echo  floatval(10.1); // 10.1

In javascript:

var a = parseFloat("10.50"); // 10.5
var b = parseFloat("10"); // 10
var c = parseFloat("10.00"); // 10
var d = parseFloat("10.1"); // 10.1

Chinese Character from mysql turned into a question mark in PHP

Problem: already knew the solution below and follow them but still not work:

DB (phpmyadmin) -- change encoding to utf8_general_ci

Backend -- header(“Content-Type:text/html; charset=utf-8”); and mysqli_set_charset( “utf8”,$connect); added.

frontend -- <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

Solution: Check again if the codes and methods are all correct. This time the
mysqli_set_charset parameter is not correct -- should be mysqli_set_charset($connect,”utf8″);

Secured By miniOrange