How many of you know, the table wp_posts is used to store the WordPress post, pages and attachments. The type of the item stored is determined by the field post_type . . With select proposed below, you can "count" individually the various types of elements in memrizzate wp_posts .
Articles Tagged 'Database'
Very short snippet: get the number of posts, Page and Attachment
Cleanfix WP 0.3.0 beta release
WP Cleanfix is a Plugin for WordPress (also compatible with WordPress MU - will exist as long as this distinction) I wrote to optimize, maintain, clean and fit our Database WordPress.

Very short trick: duplicate or clone one or more rows in MySQL
To duplicate the contents of a table full of itself, just use:
1 | * FROM MYTABLE INSERT INTO SELECT * FROM MyTable MYTABLE |
You can also use the Claus WHERE if necessary:
1 | * FROM MYTABLE WHERE a = b INSERT INTO SELECT * FROM MyTable WHERE MYTABLE a = b |
If the table has any index or unique key, which would cause an error, you can filter the fields to be duplicated:
1 | field1 , field2 , ... ) SELECT field1 , field2 , ... FROM MYTABLE INSERT INTO MYTABLE (field1, field2, ...) SELECT field1, field2, ... FROM MyTable |
Even you can duplicate a record and change a value, such as dual field and add 1:
1 | field1 , field2 , ... ) SELECT ( field1 + 1 ) , field2 , ... FROM MYTABLE INSERT INTO MYTABLE (field1, field2, ...) SELECT (field1 + 1), field2, ... FROM MyTable |
Very short trick: export with PHPMyAdmin given by
When performing an export from phpMyAdmin you can preset the field "File name template" in the "Save As ...", so that automatically adds the current date. Normally this field is preset to __DB__ , which represents the database name. By placing such __DB__-%Y%m%d otteremo the name of our database, followed by the year, month and day currents: miodb-20081010






Latest Comments
Mark : @ Mark: Thanks for the answer. For example, if you have a code to save / use the folder ...
Mark : Thanks for the answer. For example, if you have a code to save / use the folder ...
Giovambattista Fazioli : @ Mark: in principle, absolutely, a lot depends on how and what to download. La. ..
Mark : Hello, good guide! I wanted to ask, you can use the same code to run a sql database? Instead of ...
Giuseppe : Hi I wanted to ask you how you can do in the post I uploaded a gallery of 50 images, for example, ...