Support » Plugins » Database Queries

  • Hi Guys,

    I am currently working on building a function using global $wpdb to select some values to add into a hook using add_filter. Is it acceptable to run a database call more than once in a function? I am more thinking on Security issues. The code I am starting with is :-

    global $wpdb;
    
    $postinfo = $wpdb->get_results( "SELECT * FROM ls_posts WHERE ID = '$postid'", OBJECT );
    $postimage = $wpdb->get_results( "SELECT * FROM ls_posts WHERE post_parent = '$postid'", OBJECT );

    Any information would be greatly appreciated
    Many Thanks
    J

  • The topic ‘Database Queries’ is closed to new replies.