[wp-hackers] $wpdb errors

Dave W dabbaking at gmail.com
Sat Dec 23 19:36:13 GMT 2006


On 12/23/06, R.J. Kaplan <just.be.happy at gmail.com> wrote:
>
> Hi,
> I wrote a plugin that stores some data in an additional table named
> wp_designs, i use $wpdb->get_results to display the data from that
> table. It all works fine until i tried using LIKE in the sql query,
> the results come out null and i get an error (by running $wpdb-
> >print_error()) WordPress database error: [] . running the exact
> same query in phpmyadmi, I get the expected results. here's an
> example query:
> SELECT * FROM wp_designs WHERE (description LIKE '%design%' OR name
> LIKE '%design%') AND approved=1
> Any ideas?
>

I would say try and use $wpdb->query and then try to return the results with
mysql_result() and see if you get the same thing happening. That would mean
there is a problem with $wpdb->query. If that works try adding a second
argument to return it as an ARRAY_A or ARRAY_N.

-- 
Dave W


More information about the wp-hackers mailing list