Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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):

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!!
share|improve this question
    
What code are you using to generate and commit this query? As is, that update statement (if put directly in through phpMyAdmin) would not give you that output ... so we need some more context regarding how you're building the query and sending it through WP. –  EAMann Jul 13 '12 at 16:45
    
edited and added code. –  dama_do_bling Jul 13 '12 at 16:58
1  
@dama_do_bling What does $allPlays echo right before it's put into the database? –  fdsa Jul 13 '12 at 22:13
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.