How to escape percentage sign(%) in sql query with $wpdb->prepare?

This is an incorrect use of prepare, that function is used to safely insert variables into queries. However the code in your question does this beforehand, bypassing the security function. E.g. What you did: $unsafesql = “INSERT $dangerousvariable”; $still_unsafe_sql = $wpdb->prepare( $sql, ” ); What it should be: $safe_sql = $wpdb->prepare( “INSERT %s”, $dangerousvariable );

$wpbd->insert_id is returning null

I have been trying to return a $wpdb->insert_id; but unfortunately, it is returning null; That’s not true, you haven’t been returning $wpdb->insert_id at all. // insert $toevoegen = $wpdb->insert( … ); $lastinsertid = $toevoegen->insert_id; You’ve been returning $toevoegen->insert_id, which is wrong. According to the docs $wpdb->insert will return either false or it will return the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)