wpdb updating record in wordpress with json adds extra array elements

This is killing me – I keep getting magical array elements added to my updated array in WP.

For example if my query is (var_dumped below):

Read More
string(70) "UPDATE wp_mytable SET already_played = '[9]' WHERE user_id = '1'

the already_played cell shows:

[9,7]

what the hell is going on? Like i say, I var_dump the query and I’m positive its only running once… am I missing something very obvious here? Its set as MEDIUMTEXT.

EDIT here is the code:

$allPlays=array('5','6');
$allPlays=implode(',',$allPlays);
global $wpdb;
$my_table = $wpdb->get_blog_prefix() . "mytable";   
$newQuery = "UPDATE " . $my_table . " SET already_played = '$allPlays' WHERE user_id = '$userID'";
$someResult = $wpdb->query($newQuery);

//RESULT is not just 5 and 6, but 5,6,and other randoms!!

Related posts

Leave a Reply