<?php
$mydb = new wpdb('uid','passwd','database','localhost');
$mydb->show_errors();
$query = "SELECT DATE_FORMAT(col1, '%d-%b') AS Pdate, DATE_FORMAT(col1, '%Y') AS Pyear, col2, col3, col4, col5 AS fname FROM table ORDER BY col1 DESC LIMIT 50";
$result = $mydb->get_results($query);
echo $mydb->num_rows . ' in table ';
?>
Related Posts:
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- How To Make Connection To WordPress Data Base In A Plugin?
- Add value to usermeta without removing previous values?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Remove one value in dismissed_wp_pointers?
- How to check if a meta value has already been assigned to any user?
- Sum the total amount of a specific product purchased per user and display in table
- Weird 404 URL Problem – domain name being placed at end of urls
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Basic wpdb update question
- Add two or multiple functions in WordPress Post or Page
- Insert double entry in DB
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Can’t get wp_insert_post to work
- How to create a form and display its content as table in admin panel?
- Create WP_Query to search for posts by their categories or their parent/child categories
- What is a valid parent for get_terms()?
- WordPress blog post url on category page
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Get updated query results on page after insert in database
- WSoD being caused by this piece of code
- Converting HTML Template to WordPress Theme
- Extending the WP_Widget_Text class
- I want to select the from values from database in WordPress? [closed]
- WordPress not reflecting changed of the database
- mysql query from wordpress page using custom table
- Selectbox in admin panel function linking to CSS
- User management system similar to wordpress one?
- Importing Geo data into wordpress database
- Can I install/embed WordPress on a ‘single page’?
- How can I fix WordPress installation errors?
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- SQL Injection blocked by firewall
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- How to display data from custom table in wordpress phpmyadmin
- Calculating a large number of MYSQL queries as customshort codes, slow
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- Trying to build simple deposit code that hooks into woocommerce
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How to pick the default selected value in wordpress dropdown?
- How can I save unique user data on my site? [closed]
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Send an email to specific adress when button is clicked?
- Update results, Before deleting the related category [closed]
- Customizer: active_callback and sanitize_callback incompatibility?
- Saving and Restoring a Canvas on A Individual User Basis
- Redirect specific user role to specific site after login?
- Send multiple attachments with wp_mail in PHP
- Ordering users by custom user meta
- WordPress admin pointers tour bug?
- custom url rewrite for wordpress
- Extend plugin Class through functions.php
- Long running queries
- How to add a do_action on refreshing of WP customizer?
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Replacing mysql_escape_string in a custom plugin when moving to PHP7
- Customize position of social icons in upme plugin [closed]
- wp query foreach deleting record returning only first or last item
- Refresh table data with Ajax
- database sent to a JSON file
- How to get the value of input hidden html from text editor to custom page template?
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Menu jumping when calling it via PHP
- Output Video Download Link in template
- Modify custom field input data before creating a new post
- Output custom field value to post string
- inserting a post from an extern php file but post content doesn’t show on wp site
- Database query works fine outside WordPress
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Media Upload , file name changed automatically
- Replace shortcode in substring
- Custom posts in different columns style
- $wpdb->wp_users returning empty value for
- Large Woocommerce Site (83,000 items), What Can I Do? [closed]
- $wpdb->insert() does not Insert record in a table
- Need help enqueueing webfonts
- Using custom tables for old posts
- need help with existing code showing subpages
- Help with a $wpdb MySQL Query
- How do I add a custom css to all posts without affecting homepage css? [closed]
- WordPress SQL injection
- how to show only specific category for a template
- Not connecting to database in file with multiple MySQL connections
- Custom Background by Page IDs
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- How i can obtain all the post meta for a specific post as an array?
- multiple where condition in result query
- Advanced Custom Fields not displaying
- How to get private property in parent class into extended class?
- How to obtain the current website URL in my theme?