• Resolved Vijay Hardaha

    (@vijayhardaha)


    I have found SQL Syntex Error while doing Wishlist Search, error is coming from

    – file includes/wishlist.class.php
    – function get()
    – line $sql = str_replace( $replace, $replacer, $default['sql'] );

    You have to use $sql in that line in place of $default['sql']

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author templateinvaders

    (@templateinvaders)

    Hi @vijayhardaha

    Could you post exactly SQL error details, please?

    The mentioned method get() can accept a predefined SQL string attribute. You mentioned code that used to operate with SQL string passed outside, everything is correct in that case.

    Thread Starter Vijay Hardaha

    (@vijayhardaha)

    Output of $default['sql']

    
    ORDER BY {order_by} {order} LIMIT {offset},{count};
    

    Output of $sql

    
    SELECT * FROM wp_tinvwl_lists WHERE status='public' ORDER BY date DESC LIMIT 0,10;
    

    Output of $data

    
    Array
    (
        [status] => status='public'
    )
    

    Search input is also missing in queries.

    Thread Starter Vijay Hardaha

    (@vijayhardaha)

    I tracked the issue, so in file search.class.php in function htmloutput there is a $wpdb->prepare which is failing because of this kind of SQL syntax.

    
    AND (CONCAT(A.display_name, ' ', A.user_email, ' ',B.meta_value) LIKE '%demo%' )
    

    I am guessing '%demo%' becomes a placeholder inside $wpdb->prepare, hence prepare return empty value and in result, I am just getting

    
    ORDER BY 
    {order_by}
     {order} LIMIT {offset},{count};
    

    in $default['sql']

    • This reply was modified 2 years, 6 months ago by Vijay Hardaha. Reason: fixed the code formatting
    Plugin Author templateinvaders

    (@templateinvaders)

    @vijayhardaha

    Thanks for the bug report.

    It affects only when logged users get empty wishlists search results in the premium version of our plugin.

    The fix is included in the upcoming update.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘SQL syntax Error on Wishlist Search’ is closed to new replies.