prefix . "curlc_show_comment_url"; $query = "SELECT show_url FROM " . $table_name . " WHERE comment_id=$commentID LIMIT 1"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); $row = $wpdb->get_row($query); if ($num_rows==0){ $insert = "INSERT INTO " . $table_name . " (comment_id, show_url) " . "VALUES (" . $commentID . ",false)"; $results = $wpdb->query( $insert ); } else { $delete = "DELETE FROM " . $table_name . " WHERE comment_id=".$commentID; $results = $wpdb->query( $delete ); } } $location = get_permalink($postId) . '#comment-' . $commentID; wp_redirect($location,302); ?>