Articles of database

I have a table I created, how do I make a form for a user to filter the data?

I have created a table, I now need to filter the data from that table when someone selects options from a form. Whats a good way to do that?

What is the correct/safe way to delete all comments?

We’ve inherited a WordPress (3.3.2) site that has 13k pending comments, all of which are spam. To delete all these comments is it sufficient and safe enough to do: DELETE FROM wp_comments; DELETE FROM wp_commentmeta; …or alternatively TRUNCATE both tables in the database?

WordPress and automated MySQL backups to a different host

I’m having the following setup. A development computer in my local network and a production server with a real internet domain. Developing the PHP/CSS files on my dev computer for my theme is handled with git, I can easily deploy them to the production system. Up until now everything works fine. But on my dev […]

Bad Request (Invalid Hostname) on working server, database problem

I have a local server up using EasyPHP. I know its working because I have a default wordpress install running and up on my brower. I have a full site which I also know I have working because when I set up an empty database and then did the wordpress install the theme was working […]

When and why should I use $wpdb different return types?

This one returns an object $mylink = $wpdb->get_row(“SELECT * FROM $wpdb->links WHERE link_id = 10”); An associative array $mylink = $wpdb->get_row(“SELECT * FROM $wpdb->links WHERE link_id = 10”, ARRAY_A); A numerically indexed array $mylink = $wpdb->get_row(“SELECT * FROM $wpdb->links WHERE link_id = 10”, ARRAY_N); I really see no difference between them except for different ways […]

WordPress unresponsive after calling wp_update_comment()

In the admin panel’s “Edit Comment” page, for some reason after I click “Update” the Edit page goes into infinite loop/loading (the spinner icon in the Google Chrome tab never stops spinning). My computer goes into “deep think” for 10-20 minutes, even after I close WordPress, the web browser, and my IDE (I’m working locally […]

How to properly insert data into custom table via plugin

I have a plugin that reads data from an uploaded file and runs queries on the wp database. These inserts are into a table created by my plugin, so they aren’t the post type. This is how I got it working: $connection = mysqli_connect($db_host, $db_user, $db_pass, $db_name); mysqli_query($connection, $query); The problem with this is that […]

$wpdb->update has finished saving trigger?

I have a custom table that I am updating via wp_ajax action. I am inserting a row and inserting all of the values other than id which is an AUTO_INCREMENT. I have an ajax response that creates a new row on the page with the new data. In my response I need to see if […]

how to show database content in wordpress post

I’m a beginner for WordPress. I have a database app written in PHP and MySQL and I need to convert it to WordPress and also I what to post the database rows info by shortcode were id=”x” like: [plugin id=”1″] It is a small database. Just give me a small demo code or link plz. […]

Retrieve featured image (thumbnail) url from multiple posts with one query

I have a list of post ids and need to get all the standard data plus the thumbnail of the posts. As there will be several hundred posts i need an efficient way to retrieve the data, just looping over all the ids and using has_thummbnail… and all the other versions of the same ‘one […]