Monthly Archive: June 2019

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

Missing ads.txt and affecting the revenue

Problem: In AdSense panel, there is a prompt telling you that your website is missing ads.txt

Solution: Go to AdSense panel, find and copy your publisher ID (In Account Information), create ads.txt file and contains below information:

google.com, pub-your_publisher_ID, DIRECT, f08c47fec0942fa0

Put ads.txt in the website root folder, and this file must be viewable in public. And wait for a few hours to 1 day, and this will problem will be solved.

Ref:
https://support.google.com/adsense/answer/7532444

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