Deprecated: mysql_connect():

The MySQL extension: Is not under active development Is officially [deprecated][1] as of PHP 5.5 (released June 2013). Has been removed entirely as of PHP 7.0 (released December 2015) Lacks an OO interface Doesn’t support: Non-blocking, asynchronous queries [Prepared statements][2] or parameterized queries Stored procedures Multiple Statements Transactions The “new” password authentication method (on by … Read more

PHP script can’t connect to Database on port 3307

Try this one. This is connection object created to use in wordpress $mydb = new wpdb( ‘username’, ‘password’, ‘my_database’, ‘localhost’ ); and if it is way that you want to go check in codex $wpdb function ‘select’ to select database when do queries. Hope it help.

Can’t find my wordpress DB in phpmyadmin

I don’t see any reason to login as root if you only need the one database… Have you tried logging in to phpMyAdmin as the user with the same credentials as your WordPress installation? user: bn_wordpress pass: 0cca6aaab5 port: 3306 We could avoid phpMyAdmin all together… From the command line you can dump the database … Read more

Unknown collation when I import a dump from an existing site into a development database?

This issue is as a result of your server not supporting the utf8mb4_unicode_520_ci collation type. To resolve this you should convert the collation for all tables with utf8mb4_unicode_520_ci to utf8_general_ci If you’re exporting through phpmyadmin, you can: Click the “Export” tab for the database Click the “Custom” radio button Go the section titled “Format-specific options” … Read more

Set meta_key and meta_value for all registered user in wordpress using sql query [closed]

Add this code in functions.php. visit your site you, it will automatic add/update all user meta value. After executing this code just comment out or remove this code. $args = array( ‘fields’ => ‘all’, ); $blogusers = get_users( $args); foreach($blogusers as $key => $user){ update_user_meta( $user->ID, ‘is_activated’, 1 ); } OR you can also do … Read more

Can Someone Help Me Fix This WordPress Missing Argument Error?

As it says in wpdb::prepare Prepares a SQL query for safe execution. Uses sprintf()-like syntax. Thus, if you change it to: $sql = $db->prepare(“SELECT ap.photo_id, ap.creation_date, ap.owner_id, ap.file_id, ap.title AS photo_title, ap.description, aa.album_id, aa.title AS album_title, aa.category_id, sf.storage_path, u.displayname, u.username FROM engine4_album_photos ap LEFT JOIN engine4_album_albums aa ON aa.album_id = ap.album_id AND category_id <> 0 … Read more

Select multiple wp_postmeta keys with single select

If you use get_post_meta() with just the first parameter ( post ID ) you’ll get an array of all the post meta for the passed ID. You’ll get more than you expect but you can then use any number of ways to get the data that you want out. $post_meta = get_post_meta( 207717 )

Modify MySQL Query Based on Dropdown Menu

You don’t need to write your own queries, just use wordpress functions. For instance, to get post by id; use get_post <form method=”POST”> <select name=”post_ID”> <option value=”21″>21</option> <option value=”22″>22</option> </select> <input type=”submit” value=”Get Selected Value” /> </form> <?php $post_id = $_POST[‘post_ID’]; if ( is_int( $post_id ) && !empty ($post_id ) ){ $post = get_post( $post_id … Read more

How to get data from WordPress site sql file

The problem is that your images reside in /wp-content/uploads/ and without this folder, everything will be restored except images and some files you have previously uploaded to the Media Library. The plugin(s) and the theme you used could be installed (uploaded and activated) again. To backup a WordPress websites you only need to backup the … Read more

add_post_meta does not respect the content

Why the content is not being respected And it’s not just add_post_meta(), but any functions like add_term_meta() and add_user_meta() that uses add_metadata(). And the reason why the value gets serialized again is because add_metadata() will automatically serialize the meta value using maybe_serialize() which (unfortunately) will serialize the value even if it’s already serialized. How to … Read more