Exporting completed webiste for another server

It’s not difficult. You need to transfer files to the new server. Create a blank database and keep it’s name, user_name (this user must have all privileges of this newly created database) and password. Edit config.php file on new server with the these new details. Read: WordPress Codex for transferring site

$wpdb->get_var – What value is returned when zero records are found?

First, you’re using prepare() wrong. Should be this: $wpdb->prepare(“SELECT Active FROM testers WHERE user_id = %s”, $user_id) Or even better (%d) represents numeric value as oppose to %s which is string: $wpdb->prepare(“SELECT Active FROM testers WHERE user_id = %d”, $user_id) If you have any debugging enabled, it will throw an error from your code. Which … Read more

How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category

Addition note and warning: always always always take backups before doing anything in your database. It’s very easy to do something you didn’t mean to and lose tons of data, especially when dealing with DELETE statements. Also, if your database is using InnoDB for the database engine, you can use transactions via BEGIN, ROLLBACK, and … Read more

phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’

From what I can see, you are inserting data in table wp_commentmeta. However the column meta_id has a Primary Key restriction. You can see the table definition at http://codex.wordpress.org/Database_Description#Table:_wp_commentmeta As meta_id has a Primary Key restriction, this column may only hold unique values. The insert statements you have posted show only unique values for meta_id, … Read more

mySQL queries are executed twice on wordpress website

The use of wpdb->insert and wp_insert_post both accomplish an SQL Insert, which is why you’re seeing 2 records each time. You must use only one instance of an insert method, and then Pass $my_post to WP_Query CLARIFICATION As Milo points out in his comment wpdb->insert will insert into any table, while wp_insert_post is used to … Read more

Changing host permissions for MySQL users

If you’ve got access to the mysql database, you can change the grant tables directly: UPDATE mysql.user SET Host=”%” WHERE Host=”localhost” AND User=”username”; …and an analogous UPDATE-statement to change it back. Also you might need to make changes to the mysql.db table as well: UPDATE mysql.db SET Host=”%” WHERE Host=”localhost” AND User=”username”; and then flush … Read more

Adding data to custom wordpress database table

WordPress doesn’t work this way. If you want to work with a framework like WordPress, you should obey its rules! Of course you can add a database record like this, but it is a really bad approach. Try some plugins for creating and saving forms in WordPress like Ninja Forms or Quform. You can even … Read more