If you’re evaluating php variables in a string(interpolating the variables directly in a string), it’s best to use double quotes, this way you don’t have to concatenante with dots.
function get_highest_bid( ) {
global $wpdb;
$postid = get_post_id();
$table = $wpdb->prefix . "jwp_bids";
$highest_bid = $wpdb->get_var(
"Select max(bid_amt)
FROM $table
WHERE post_id ='$postid';"
);
echo $highest_bid;
}
Related Posts:
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Link to user’s profile settings page?
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Shared functions.php across multiple WordPress websites
- How to restrict actions and filters “properly” by conditions
- Extending auth_cookie_expiration based on user role
- Check if the user has explicitly set an excerpt
- AJAX handler throws 400 (Bad request) – why?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Slugs as breadcrumbs for Pages
- Conditional tag is_page with a custom post type
- Add inline css to theme
- Shortcode with custom content attribute?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automatically add author’s name to post_tag
- Print Dashboard menu name and link
- Enqueue styles after a plugin
- Develop function get_template_part in functions.php
- Change comment_reply_link URL
- Ajaxing function in widget class
- Super simple shortcode not working
- Using “Read More” link with custom excerpt
- what function can I use to automatically output og tags per page/post?
- Add error message on password protected page ONLY when password introduced was incorrect
- Select pages by category
- wp_register_script(… $in_footer = true) not working
- Restore Image Title Text
- Output and filter data from a XML url
- Where to start learning more about wordpress templates [closed]
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- How do I create a function that simulate the click on Update button for all posts?
- Parse error after modifying the template menu [closed]
- Reuse variable in hook callback
- Multisite Ajax serialize return error [object Object]
- Full page template function
- PHP mixed with some JS code to update WordPress theme settings
- What does this code do? (Injected code hacked)
- Wp admin – Set default value to 999 in comments
- WordPress listen to $_POST in functions.php
- wordpress use single ajax in place of multiple ajax requests in a smarter way
- Add Element as a Filter to the_content
- Is my code correct to enqueue CSS on a specific page?
- Can’t properly set the_title add_filter to show short_URL
- WordPress function, Run using Crontab
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Why There Is No “get content by ID” Function
- Missing argument for the function
- custom functions in function file delete automatically daily
- get_next_posts_link() returns no result despite available posts
- Randomizing wp_tag_cloud() in child theme
- Init action and refresh page after form action
- Replace plugin function with a custom function?
- Delay a function, any function!
- Combine two active_callbacks into one on theme customizer
- How to create shortcode with html and php content?
- wp_usermeta – Read from database, but save function broken
- Fill empty custom field with other custom field
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- How do I find the code executed when wp_head() is called?
- Problems with functions.php! Error! [closed]
- Output comment_author in array
- Editor cannot access Theme Options
- Problem with shortcode inside a shortcode
- Include widget file in functions.php of child theme
- Need help making a short code work
- Is there a function for setting a password to a post?
- WordPress functions.php conditional include another functions file
- reWrite wp-content url to point on my cdn
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- sort title descending with title with number
- Add #primary at the end of navlink permalinks on single posts
- Author social media aren’t shown on the page
- Is there anyway to force is_singular() to be true when not loading template?
- Postback redirect through add_action is not triggered
- How to add class dynamically from templates
- How to change form action of wp-login page with a function
- How to make an If Else on Excerpt Filter
- Translation Function missing text-domain [closed]
- get_comments not working properly after WordPress v4.4 update
- Retrieve a custom form field modified by a filter
- Custom taxonomy not refreshing page on add
- What add_action reference should I be using or should I use do_action?
- Pagination in Search result
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Allow the access over wp-login.php
- Create input select image URL?
- Including one page with WordPress functions into another
- Dynamically Generating User Meta Field
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- Changing functions.php and .htaccess files
- Shortcode Variations?
- Code in functions.php appearing on front-end and dashboard [closed]
- Sessions in word press [duplicate]
- “woocommerce_output_related_products” not working
- Get all users from role and add to dropdown (select) – wordpress, javascript
- WordPress enque the same script causes the setInterval not to work