ampersands $wpdb and headaches
-
The piece of code below has me puzzled to no extend. I’d love to find a solution to the ampersand issue.
The code below works fine, pulling a post title in and looking up data in a custom table (inside the wordpress database) …. HOWEVER …. if the post title contains an Ampersand (&) the code breaks.
The really annoying thing is that when I enter the post-title (e.g. bacon & eggs) directly into the SELECT statement below (instead of the variable $bedrijftitel) , the code DOES work.
I’m sure it’s staring me in the face but the solution has eluded me so far …. Your help would be much appreciated.// get bedrijfsdata from custom table $bedrijftitel = get_the_title(); $bedrijfsinfo_uit_db = $wpdb->get_row('SELECT * FROM bedrijfsinfo WHERE bedrijfsnaam = "'. $bedrijftitel . '" ');
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘ampersands $wpdb and headaches’ is closed to new replies.