Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix code wrapping

  • Loading branch information...
commit 715cd37f2020338f5bc384b0f9eae4a26494c65d 1 parent fa51938
@petdance authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 s/php.md
View
14 s/php.md
@@ -79,11 +79,21 @@ WordPress
If your site/blog/application is running on [WordPress](http://wordpress.org), you can use the `prepare` method of the `$wpdb` class, which supports both a sprintf()-like and vsprintf()-like syntax.
global $wpdb;
- $wpdb->query( $wpdb->prepare( "SELECT name FROM people WHERE id = %d OR email = %s", $person_id, $person_email ) );
+ $wpdb->query(
+ $wpdb->prepare( "SELECT name FROM people WHERE id = %d OR email = %s",
+ $person_id, $person_email
+ )
+ );
For INSERTs, UPDATEs, and DELETEs, you can use the handy helper methods in the class, which allow you to specify the format of the submitted values.
global $wpdb;
- $wpdb->insert( 'people', array( 'person_id' => '123', 'person_email' => 'bobby@tables.com' ), array( '%d', '%s' ) );
+ $wpdb->insert( 'people',
+ array(
+ 'person_id' => '123',
+ 'person_email' => 'bobby@tables.com'
+ ),
+ array( '%d', '%s' )
+ );
More details on the [WordPress Codex](http://codex.wordpress.org/Class_Reference/wpdb).
Please sign in to comment.
Something went wrong with that request. Please try again.