I am trying to use a variable with wpdb->prepare but it’s not working for some reason.
I’ve built this statement in my code:
“UPDATE wp_eventuser_tbl SET fname = %s, lname = %s, active = %d WHERE id = %d”, Steven, Nowickcow, 0, 10
and set it equal to $strQuery.
but, when i execute this line:
$wpdb->query( $wpdb->prepare( $strQuery ) );
it doesn’t work.
however, I can cut and past the statement exactly and replace $strQuery and the code updates perfectly.
any clues as to why it won’t execute using $strQuery?
- The topic ‘$wpdb->prepare with variable’ is closed to new replies.