Skip to content
Advertisement

WordPress: How to update data in database using PHP with MySQL?

I am using core PHP to make WordPress custom page template for my website, but when I am updating user id, it was not updating the user id.

Suppose I have a user in database and when the user pay amount using PayPal, make that user id 1. By default its id is 0.

I want to make that user status to 1 when paid.

Advertisement

Answer

Your code should work. But without knowing the full source code we don’t know why it doesn’t work.

Although you can do update $wpdb->query, $wpdb does have a better way to update a row. Use $wpdb->update instead.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement