Database create or redirect

Not having cPanel doesn’t mean you can’t create a database, but if you are trying to install WordPress on a server without a database server, that is your biggest problem. I would consider other hosting. Your questions in order: cPanel is a convenience. So are Plesk and other similar pieces of software. If you have … Read more

Fetch a single row from a custom table for to a given ID

$wpdb->wp_philosophy_philosopher won’t work here because it has not been defined. $wpdb->table_name works only with default tables. You can create your own using: $wpdb->philosophy_philosopher = $wpdb->prefix . “philosophy_philosopher”; Note that the wp_ is just the table prefix and has been omitted here because different installations can have different prefixes and that your code stop to work … Read more

wpdb prepare sql problem

To get a % character into your SQL string without confusing sprintf() add it to the replacement string: $alabala_sql = $wpdb->prepare( ” SELECT * FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id=tt.term_taxonomy_id INNER JOIN $wpdb->terms t ON t.term_id=tt.term_id and t.slug= %s WHERE p.post_title LIKE %s AND … Read more

Second ezSQL initialization for MSSQL

I apologize for the late reply, I was transferred to a new project and forgot about it. I ended up using a standard PHP PDO connection. Here is an example: // connection variables $servername = “localhost”; $database = “database”; $user = “username”; $pass = “password”; try { //create connection $DBH = new PDO(‘sqlsrv:Server=”.$servername.”;Database=”.$database, $user, $pass); … Read more

add_post_meta — not working

What user34296 said is update_post_meta() will update the value of the existing meta key (custom field) for the specified post. If it does not already exist it will call add_post_meta($post_id, $meta_key, $meta_value) instead. That’s why you should use it. EDIT: in this case it should work, error is coming from another part of the code. … Read more

SQL Statement – Mass Delete Custom Post Types

Trust you have backed up your wordpress database. In any case, as the article suggests, worth trying with a select statement first to see which posts are returned: SELECT DISTINCT ID, post_title, post_type, post_status, d.taxonomy, e.name FROM wp_posts a LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id ) LEFT JOIN wp_postmeta c ON ( … Read more

Copying blog from root to /folder (Not moving)

Copy all of the files to the new folder. For the database, you’ll need to use something like PHPMyAdmin to export the current database as a .SQL file. Edit the .SQL file you downloaded to remove the first statements specifying what database to use (it will be “USE database”). You’d then need to create a … Read more