I'm just trying to insert values into custom table of wordpress and it throws me this error
WordPress database error:
[You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near
'( post_id, site_id, u_id, is_present )
VALUES ( 989, 139, '1' at line 2]
INSERT INTO ( post_id, site_id, u_id, is_present ) VALUES ( 989, 139, '10822456', 'false' )
I'm using prepare query to Protect Queries Against SQL Injection Attacks.
Here is my code
$wpdb->query($wpdb->prepare(
"
INSERT INTO $wpdb->wp_plugs
( post_id, site_id, u_id, is_present )
VALUES ( %d, %d, %d, %s )
",
$post_id,
$site->ID,
$u_id,
'false'
) );
Aucun commentaire:
Enregistrer un commentaire