Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5527

vantezzen on "A Question about wpdb->prepare()"

$
0
0

Hello,
I never used wpdb->prepare or sprintf() before, so I have a question about them:
When I execute something like that:

$table_name = $wpdb->prefix . 'mysqlitable';
$wpdb->prepare('INSERT INTO ´%s´( ´name´ , ´num´ ) VALUES ("%s", "%s")', array($table_name, $listname, $number));

The outcomming Query is:
INSERT INTO ´'wp_mysqltable'´ (name,num) VALUES ('test', '1');
But because of the ' that was included there, the query is invalid. How do I fix that?

PS: The backticks in the query are normally in the right direction but thanks to the wordpress forum code they are changed to "< code>" so I had to flick them`


Viewing all articles
Browse latest Browse all 5527

Trending Articles