By Hawkcode on
I'm just starting to work in Drupal and have no experience with objects.
I'm using :
$user = user_load(array('name' => $someUid));
Then trying to compare a value in the object table to a value in an array read from a csv file, like this:
if ($user['aspe_firstname'] <> $UserRecord[$FirstNameNum]){
$RecordUpdated = True;
$new_user['aspe_firstname'] = $UserRecord[$FirstName];
}
$FirstNameNum is a number, $FirstNameNum = 5
The program dies when it hits the if. How can I do this compare?
I'm also fairly new to arrays.
Thanks Rich
Comments
You can access an element of
You can access an element of an object using an arrow:
$user->uid
$user->name
These will give you the uid and name that are stored in the user object.
Contact me to contract me for D7 -> D10/11 migrations.