dimanche 4 octobre 2015

$wpdb->update() not working

I am modifying an existing plugin by creating an extension to it. I am trying to update a row with basic info just to test to see if the $wpdb->update works, but even using plain values it seems to get stuck. Please take a look at this image. The form keeps showing the working symbol but when I look in the database a new row has already been created, so the post went through. I think it is getting stuck on my lines of code below. I read some other similar questions on this website where people solved the problem by putting the $data and $where terms into variables, so I did that. It made it easier to read, but it doesn't seem to fix my problems.

$amount_field_col = array('post_amount' => '12.15');
$where_clause = array('ID' => '30');
$wpdb->update('wp_posts', $amount_field_col, $where_clause);

Any idea why it might not be updatig the row and why it could be getting stuck? The overall goal here is that I made a new field to an existing form and I want to be able to take inputs to the form and plug it into a new column I made in PHPMyAdmin called post_amount.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire