[wp-hackers] Plugins using hardcoded table prefix

Owen Winkler ringmaster at midnightcircus.com
Tue Mar 22 14:02:52 GMT 2005


David House wrote:
>>This works:
>>
>>$sql = "SELECT * FROM {$wpdb->posts} WHERE ...";
> 
> Not necessary. You can use the $object->property syntax from inside
> double quotes as well, as stated in the PHP documentation:

True, yet I should have made it more apparent (and relevant to the 
thread) that without the above syntax, this is difficult:

$sql = "SELECT * FROM {$table_prefix}my_plugin_table";

Stylistically, I like to keep all of my in-double-quote variable 
references inside braces because I can scan for them visually a bit 
easier and they're easier to copy and paste into places where braces 
would be required.  But I admit that I have certain quirks I like to 
adhere to as a personal standard.  ;)

Owen



More information about the wp-hackers mailing list