See if the email exists or not

First, you need to create the following function: function checkEmailAlreadyExists( $message_id ) { $posts_with_meta = get_posts( array( ‘posts_per_page’ => 1, // we only want to check if any exists, so don’t need to get all of them ‘post_type’ => ‘my-custom-post-type’, ‘meta_key’ => ‘ticket_id’, ‘meta_value’ => $message_id, ‘fields’ => ‘ids’, // we don’t need it’s content, … Read more

Passing in MySQL prepare statement parameter separately throwing error

$query = (“SELECT * FROM <tablename> WHERE user_id = {$user_ID}”); // string variable $stmt = $wpdb->prepare($query); Say your $user_ID is 9, this will get evaluated to: $query = (“SELECT * FROM <tablename> WHERE user_id = 9”); $stmt = $wpdb->prepare($query); and finally becomes $stmt = $wpdb->prepare(“SELECT * FROM <tablename> WHERE user_id = 9”); Now it is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)