vendredi 21 septembre 2018

how to get user uid from firebase database and print it on the table

[enter image description here][1]

[enter image description here][2]

please help me get the user UID from firebase. how can i retrieve the user uid and show it on the table? i cannot delete it and update. please tell me how.

 
           function readTask(){
        var UserInformation= firebase.database().ref("UserInformation/");
        UserInformation.on("child_added",function(data){
        var taskValue= data.val();
         function tabappend(id, name, gender, email, phone,bloodType, 
         birthday) {
           // playerlist is the ID of the table
        var tab = document.getElementById('table');
        var row = tab.insertRow(-1);    // append to table
        var id = firebase.auth().currentUser.uid;
 
        var cell0 = row.insertCell(0);  
        var cell1 = row.insertCell(1);
        var cell2 = row.insertCell(2);
        var cell3 = row.insertCell(3);
        var cell4 = row.insertCell(4);
        var cell5 = row.insertCell(5);
        var cell6 = row.insertCell(6);  


            cell0.innerHTML = id;
            cell1.innerHTML = name;
            cell2.innerHTML = gender;
            cell3.innerHTML = email;
            cell4.innerHTML = phone;
            cell5.innerHTML = bloodType;
            cell6.innerHTML = birthday;
 
            if (ready == true) {
            cell2.innerHTML = "✓";
            cell2.class = "ready";
            }
              }

            document.getElementById("table").innerHTML+=`
            <tbody>
            <tr>
             <td>${taskValue.id}</td>
       <td>${taskValue.name}</td>
            <td>${taskValue.gender}</td>
    <td>${taskValue.email}</td>
       <td>${taskValue.phone}</td>
       <td>${taskValue.bloodType}</td>
       <td>${taskValue.birthday}</td>
  
  
         </tr>
         </tbody>   
          `

      });
   
     }



 
  



Aucun commentaire:

Enregistrer un commentaire