How to add download link from database on custom page template?

/*you’re expecting a single row result so better use $wpdb->get_row ..$id I guess it’s numeric so dont’use quote*/ global $wpdb; $download = $wpdb->get_row(“SELECT realname FROM odm_data where id=”.$id); <a href=”https://wordpress.stackexchange.com/questions/308676/download.php?file=<?php echo $download->realname ?>”>Download</a>

database error WordPress move from one hosting to other

The credentials for your database are located in the wp-config.php file. Make sure those settings are correct. In particular, non-ASCII characters may be causing a problem. Or an extra space in any value (especially the password). Look at the user/pass/dbname in your host also. An extra space at the end of the password in wp-config … Read more

Use admin-post to submit form data to external database

I’m answering this question to help future WordPress developers on their quest for knowledge. The answer is YES, you can connect to an external database when using the admin_post action. Below is the corrected source… <?php class x94 { private $externalDB01; public function __construct(){ add_action( ‘admin_post_submitForm9’, array( $this, ‘formHandling’ ), 11, 1 ); add_action( ‘plugins_loaded’, … Read more

create a table using user meta custom data

See how the data is stored in the database in the table “wp_usermeta” Find the storage keys for “points”, “training completed” Then using the function https://codex.wordpress.org/Function_Reference/get_users $users = get_users( $args ); foreach ( $users as $user ): echo $user->ID; echo $user->display_name ; echo get_user_meta( $user->ID, ‘KEY_POINTS’, $single = true); echo get_user_meta( $user->ID, ‘KEY_TRAINING_COMPLETE’, $single = … Read more