Drupal 6.22 installation stuck at database configuration

When we install a new drupal 6.22, after the first 2 steps:

  1. Choose language
  2. Verify requirements

The third step “Set up database” may prevent you from installing successfully. There are not any error messages to show what the problem is either. How to do then?

During the installation you may have renamed the file /sites/default/default.settings.php to /sites/default/settings.php.

However, Drupal expects you to make a copy if this file, not rename it! So you will know what to do now. Just copy default.settings and save it to /sites/default/.

Done.

Posted in Drupal. Comments Off on Drupal 6.22 installation stuck at database configuration »

How to using PHP to delete wordpress coments?

Sometimes there are thousands wordpresss comments there, it is too difficult to delete them. Any method to delete them one time without login phpmyadmin?

The answer is yes, the follow code can help you.

include(‘wp-config.php’);
mysql_query(“truncate table wp_comments;”);

Copy the code to file delete_wp_comment.php, and put the file under your blog. Run it, all comments will be deleted!

If you only want to delete spam or trash comments, please visit http://kingphp.com/160.html , and just change some code. Very simple!

Posted in MySQL, Php Code. Comments Off on How to using PHP to delete wordpress coments? »

Get WordPress Current Category URL and Link

<?php
global $wp_query;
$cat_obj = $wp_query->get_queried_object();

// Get the ID of a given category
$category_id = get_cat_ID( ‘Category Name’ );

// Get the URL of this category
$category_link = get_category_link( $category_id );
?>

<!– Print a link to this category –>
<a href=”<?php echo $category_link; ?>” title=”<?php echo $cat_obj->name; ?>”><?php echo $cat_obj->name; ?></a>

 

Posted in WordPress. Comments Off on Get WordPress Current Category URL and Link »

Mass Delete trash post from WordPress

Q:I want to mass delete my trash with 2000+ Posts in it. Is there a mysql command to do so?

A: Please backup before running the query, i’ll not take responsibility if something goes wrong as a result..

DELETE p
FROM wp_posts p
LEFT OUTER JOIN wp_postmeta pm ON (p.ID = pm.post_id)
WHERE post_status = ‘trash’

Join is optional, removes entries from the meta table (if they exist).

Check your data base table prefix also, if it is not wp_, you have to change it to your table prefix.

Tested under MySQL 5.1 in Phpmyadmin.

Posted in MySQL, WordPress. Comments Off on Mass Delete trash post from WordPress »

How to change wordpress post author?

Here is the perfect steps to change wordpress post author:

1) Login into wordpress admin area.
2) Click on Edit in the Posts section.
3) Select the posts for which you need to edit the author details.
4) From the top there is drop down for bulk actions -> select edit and apply.
5) Now, you can change author, comment, status, pings, sticky, categories etc..,
6) After changing the value of author..click on update posts..

That’s it!

Posted in WordPress. Comments Off on How to change wordpress post author? »

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 we need. (more…)

Posted in WordPress. Comments Off on Only show for en Language »

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 default ‘0’, `cache_name` varchar(255) NOT NULL default ”, `cache_data` mediumtext NOT NULL, `cache_global` tinyint(1) NOT NULL default ‘1’, `cache_gzip` tinyint(1) NOT NULL default ‘1’, `cache_method` varchar(20) NOT NULL default ‘RETURN’, `cache_date` datetime NOT NULL default ‘0000-00-00 00:00:00’, `cache_expires` datetime NOT NULL default ‘0000-00-00 00:00:00’, PRIMARY KEY (`cache_id`,`cache_language_id`), KEY `cache_id` (`cache_id`), KEY `cache_language_id` (`cache_language_id`), KEY `cache_global` (`cache_global`) ) TYPE=MyISAM

Very simples, just change “TYPE=MyISAM” to “ENGINE=MyISAM”, and login in phpmyadmin, run the mysql sentense, done!

 

Posted in MySQL. Comments Off on Zen Cart Install – #1064 – You have an error in your SQL syntax »

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′”); (more…)

Posted in MySQL, Php Code. Comments Off on Using PHP to Export Mysql Data to Excel »

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 the new database user name.

next modify the user password in your software config file, for example, if you use wordpress, you have to modify wp-config.php; if you use vbulletin forum, just modify config.php

Posted in MySQL, Vbulletin, WordPress. Comments Off on Change Hostgator MySQL Password »

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 time if you delete them via WordPress Blog own functions. Here we will teach you how to delete them via phpmyadmin! (more…)

Posted in Php Code, WordPress. Comments Off on Mass Delete Comments from WordPress »
King Php Science Designed by:KingPhp.com Welcome, you are from: 77.75.76.161