Jump to content


  • Posts

  • Joined

  • Last visited

davedpss's Achievements


Newbie (1/7)



  1. $profile->{$key}[0]['value'] = $value; The code above also worked and was more in line with what I was trying to do. I'll look up what the curly braces around the variable do.Thanks to all for their help.Dave.
  2. @justsomeguy, Thanks, that worked. I am curious as to why if I used the value of $key in stead of the variable e.g. $profile->field_first_name[0]['value'] = $value; that this worked. I would have thought that the arrays were created when I loaded the $profile object (earlier in the script). I have a similar script where I reference all the object properties by name instead of using a variable as part of the name and they all work??? Oh well, this fixes the issue. Thanks very much. Dave.
  3. $profile is an object and I need to update properties of that object and then use node_save($profile) function to update the database. The issue is that the property names all have [0]['value'] in them. For example the $key variable might be "field_first_name" and the property to update is "field_first_name[0]['value']". I'm just having trouble trying to figure how to combine the value of $key with the string "[0]['value']" to create the property name. Thanks.
  4. This is on a drupal 6 site. I need to spin through an array and set content profile properties using the $key followed by [0]['value'] = $value; I keep getting errors and can't figure out how to create the property dynamically. Here is the code: foreach ($profile_array as $key => $value) { $profile->$key[0]['value'] = $value;} I have tried multiple variations of concatenating $key to [0]['value'] including creating variables and then inserting them in place but nothing is working. Any suggestions on what I can try would be appreciated. Thanks.Dave.
  5. I am trying to clean up some text that has some white space that I can't seem to get rid of. I have tried replacing \s, \t,\n, \r, \r\n etc. and that strips out most of the new lines but not all. When I look at in a text editor such as TextWrangler, I am seeing an upside down question mark where these spaces are. I thought instead of trying to match something and then deleting that I could try to delete everything but what matched. I don't know how to do this with regular expressions. If anybody had a pattern and a replacement that would work, I would appreciate it. Thanks - Dave.
  6. Nope, that won't work. I need all the user records and only one membership record per user. Limit 1 returns only one user.
  7. I have a user table with one record per user and a membership table with a record for each user for each year they have joined. I need a query that will find each user that is not a current member (mstatus = Non-Member) and only the latest record for that user in the membership table, if there are any. I can't figure out how to filter the joined table (membership) to only get the latest record.Select * from user Left Join membership on user.id = membership.userid;This gives me all the records for membership and I only need the latest. MySQL 4.0.24.Thanks - Dave.
  8. $taxname = $variables['taxonomy']['taxonomy_term_'.$termid]['title']; worked (someone from another forum gave this to me) which is basically a variation of what you have here. Thank you. I made it harder than it had to be.
  9. I need to access an array value but don't know all the values to call until I get them from a different array value. I'm not explaining this well so I will show some of the code below (This is from a drupal based website). I want to access this value: $variables[taxonomy][taxonomy_term_1083][title]The problem is I don't know the term id (1083) until I have accessed this value: $variables[field_journal_name][0][value] I have tried creating a string that combines the term id with the rest of the array: $termid = $variables[field_journal_name][0][value]; $taxname = 'variables[taxonomy][taxonomy_term_'.$termid.'][title]';and then using the variable variable method: $name = ${$taxname};and many different variations of this but nothing seems to work. Any ideas would be greatly appreciated. Thanks - Dave.
  • Create New...