Only show for en Language

Now more and more adsense accounts are banned due to useless trafice, especially non-English speaking countries trafic, we can add the following code to test our visiters Computer language: $_SERVER[‘HTTP_ACCEPT_LANGUAGE’] <?php $a = $_SERVER[‘HTTP_ACCEPT_LANGUAGE’]; echo $a; ?> We can get different results, such as en-US, en-Ca, zh-CH. We can use substr() to get certain numbers […]

Zen Cart Install – #1064 – You have an error in your SQL syntax

After install zen cart v1.3.9h, the front page show:   #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=MyISAM’ at line 1   CREATE TABLE seo_cache (`cache_id` varchar(32) NOT NULL default ”, `cache_language_id` tinyint(1) NOT NULL […]

Using PHP to Export Mysql Data to Excel

  <?php  $DB_Server = “localhost”;    $DB_Username = “put your user name here”;    $DB_Password = “put your password here”;    $DB_DBName = “put your database name here”;    $DB_TBLName = “put your table name here”;       $savename = date(“YmjHis”);  // excel file name $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die(“Couldn’t connect.”);    mysql_query(“Set Names ‘utf-8′”);

Change Hostgator MySQL Password

Sometimes we want to change hostgator mysql database user password, or we have to change when we forgot the password. How to do? Very simple infact, first delete the user name of the mysql and remake it, but make sure you use exactly the same name when remaking. then bind the old database name to […]

Mass Delete Comments from WordPress

Pending links, Spam links, or Trash links with a WordPress powered blog can grow really quickly and most is spam. Word Press allows you to remove such comments but only 20 at a time. What if you have thousands pending links, spam links or trash links need to be deleted? You will wast a lot […]

explode and foreach to show strings or ASCII

//transfer ASCII to string $string = “78b101b116b87b105b110b100”; $tags = explode(‘b’, $string);  foreach($tags as $key) { echo chr($key);  } //transfer string toASCII echo “<br><br>”; $string = “Tiger Young”; foreach($tags as $key) { echo ord($key).”b”;  } echo “<br><br>”;

wp-includes\taxonomy.php on line 1518

I am using XAMPP, and wordpress 3.0.4, today when I want to show all post, the following error message shows: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in D:\xampp\htdocs\wp\specsexpert\wp-includes\taxonomy.php on line 1518

WordPress Ad Code Skills

Sometimes we want our ads codes show differently at our wordpress blog. Say we want to show adsense codes different types at different place, say homepage, single post. Simple! The following code will show your ad code one at single post and single page, and ad code two at other places:

Old domain to new domain – different accounts

We can use the following code, and paste them in .htacess file: Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^old-domain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.old-domain.com$ RewriteRule (.*)$ http://www.new-domain.com/$1 [R=301,L]

Category ID from current URL nicename and show some posts name

We can use the following code to get category ID from current URL nicename: We can use the following code to get category ID from current URL nicename: <?php if(is_category() || is_single()){  $category = end(get_the_category());  $current =$category->cat_ID;  $current_name = $category->cat_name; } echo $current_name . ” has id “.$current.” and is called “.$current_name; ; ?>