I'm running into something really weird all of a sudden.......

I have 2 fields using 'Explode' and both are exploding on '>>' to put terms into the db.

The first vocab, "Business Category" is working fine.

It looks like this:
-Autos
--Auto Detailers

The created node (er....entity) gets created with both of those values.

However, the second field using a different vocab ('Coupon Type') is bombing on the children. It looks like this:

-% Off
--5

The created entity gets the value of '% Off' but not the '5'. It's being inserted into the db as '5' to boot! (As opposed to matching on the '5' and inserting that tid.)

However, if I change the second vocab ('Coupon Type') to this:
-% Off
--five

.....it works.

I swear I had this working earlier and am absolutely perplexed. (Which invariably means it's something ridiculous, usually.)

Hence, my reluctance to get into bug-fixing mode.

Thanks.

CommentFileSizeAuthor
#3 explode_d.PNG5.14 KBotcassetmgmt

Comments

aaronelborg’s picture

twistor’s picture

Status: Active » Fixed
otcassetmgmt’s picture

StatusFileSize
new5.14 KB

If I use a string it works, but I can't use the explode function on a straight up $variable it doesn't output an array?

This works

$half_string = "MONMOUTH: 37 WAGNER: 41 17:57 2nd Half";

$string_half = substr_replace("$half_string"," ",-14);
print_r(explode(":",$string_half));

$final_string = "NEW MEXICO: 77 SAN DIEGO ST: 67 FINAL";

//note below $string_final is a test

$string_final = substr_replace("NEW MEXICO: 77 SAN DIEGO ST: 67 FINAL"," ",-5);
print_r(explode(":",$string_final));

This does not work it outputs a string screenshot attached

function user_sub_home_page(){
  $output = NULL;
  $s_id = arg(1); //current odds info
  $snode = node_load($s_id);
  
  $half_string = $snode -> field_h_string_score ['und']['0']['value'];
  

$string_half = substr_replace("$half_string"," ",-14);
(explode(":",$string_half));
    
print_r ($string_half);
  
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.