[wp-hackers] Percent in $wpdb->prepare()?

Jobjörn Folkesson jobjorn at gmail.com
Tue Feb 3 21:37:27 GMT 2009


Hello everyone,

I am slowly learning to build plugins for BuddyPress, and I love the
WordPress platform. One of the many great things it provides is that nifty
database input sanitization function provided in $wpdb - noone likes a Bobby
Tables incident.

However, when I try to use it to add a row where one cell contains the
percent sign ("%"), nothing happens. What am I doing wrong?

Example:
$wpdb->query($wpdb->prepare("INSERT INTO testtable(test) VALUES ('71% of the
surface of the Earth is water.')"));

Thanks in advance!

Jobjörn Folkesson
Uppsala, Sweden


More information about the wp-hackers mailing list