• Resolved supernova42

    (@supernova42)


    I can use the following routine to get the user_id of the logged in user.

    $current_user=wp_get_current_user();
    $wp_username=$current_user->user_login;
    $user_id=Participants_Db::get_record_id_by_term(‘username’,$wp_username);

    I can use the following rotines to fill an array with data

    $data=array(‘name’ => ‘Steve Reynolds’);
    $data=array(‘age’ => ’36’);
    $data=array(‘town’ => ‘Swindon’);

    I can use the following statement to write this data back to the Participants DB

    Participants_Db::write_participant($data);

    but how do I ensure it goes back to the correct record which is given by $user_id

    Where do I slot in the $user_id into the command

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter supernova42

    (@supernova42)

    Okay thanks Roland, I have it working perfectly now.
    One question about the value of id though which I will raise in another thread

    for($i=1; $i<=1000; $i++) {
    $data=Participants_Db::get_participant($i);
    $user_id = $data[‘id’];
    $username = $data[‘username’];
    $boatname = $data[‘boat_name’];
    if(!empty($username)) {
    if (empty($boatname)) {
    echo $username.’:’.$boatname.'<br>’;
    $data = array();
    $data[‘id’]=$user_id;
    $data[‘username’]=$username;
    $data[‘boat_name’]=’Name Needed’;
    Participants_Db::write_participant($data);
    }
    }
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Writing to a PDB Record’ is closed to new replies.