title: Saving a fetched result back into the database
body: <p>i want know how I can save a result i fetched  from my database back into the database. </p>
  
  <p>I selected and fetched a row from a table in my database, there is a column from the row i want to insert in another table in the same database. I tried to turn the $row['example']; to a variable but it wont work, i echo the variable to be sure if its working but its not showing . </p>
  
  <p>please i need a help , below is my codes.</p>
  
  <pre><code> &lt;?php
           $query =mysqli_query ($dbconnect, "select * from stuprofile where     username ='$user' limit 1");
  
              while ($row= mysqli_fetch_assoc($query)){?&gt;
  
  
               &lt;?php
               $uname= "USERNAME :";
               $ebc= "EBC16";
               $id ="MATRIC NO : ";
               $wel = "WELCOME ";
               $name ="FIRSTNAME : ";
               $lname ="LASTNAME : ";
               $sex ="SEX : ";
               $add ="ADDRESS : ";
               $mob ="MOBILE : ";
               $inst ="INSTITUTION : ";
               $chap ="CHAPTER : ";
               $marr ="MARITAL STATUS : ";
               $lc ="LOCAL CHURCH : ";
               $bap ="BAPTISM : ";
               $baptised ="BAPTISED : ";
               $bank ="BANK : ";
               $teller ="TELLER NUMBER : ";
               $pay ="PAYMENT NUMBER : ";
               $email ="EMAIL : ";
               // dont forget to style your above varibles
  
  
              //&lt;span id ="ty"&gt;
              ?&gt; 
  
  
              &lt;div class="wel"&gt;
              &lt;?php
                       echo "&lt;p&gt;"  . $wel .  "&lt;div id='ten' &gt;" .  " " .     $row['firstname'] . "  " . $row['lastname'] . "&lt;/div&gt;" . "&lt;p&gt;" . "&lt;br /&gt;" ;
  
              ?&gt;
              &lt;/div&gt;
              &lt;!--&lt;section&gt;&lt;img src= "images/egliselogocomp.jpg" height="310" width: 50px&gt; &lt;/section&gt;--&gt;
  
  
              &lt;p class= "names"&gt;
  
      &lt;?php
  
  
                  echo 
                      $id  .  "&lt;span &gt;" . $ebc . $row['id'].  "&lt;/span &gt;" . "   &lt;br /&gt;" .
                      $name  .  "&lt;span &gt;" . $row['firstname'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $lname .  "&lt;span &gt;" .$row['lastname'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $uname .  "&lt;span &gt;" .$row['username'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $sex    .  "&lt;span &gt;" .$row['sex'] . "&lt;/span &gt;" . "&lt;br /&gt;" . 
                      $add    .  "&lt;span &gt;" .$row['address'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $email .  "&lt;span &gt;" .$row['email'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $mob    .  "&lt;span &gt;" .$row['mobile'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $inst .  "&lt;span &gt;" .$row['institution'].  "&lt;/span &gt;" . "&lt;br /&gt;" . 
                      $chap   .  "&lt;span &gt;" .$row['chapter'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $marr .  "&lt;span &gt;" .$row['marital_status'].  "&lt;/span &gt;" . "&lt;br /&gt;" . 
                      $lc .    "&lt;span &gt;" .$row['local_church'].  "&lt;/span &gt;" . "&lt;br /&gt;".
                      $bap .  "&lt;span &gt;" .$row['baptised'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $baptised .  "&lt;span &gt;" .$row['baptism'].  "&lt;/span &gt;" . "&lt;br /&gt;" .
                      $bank .  "&lt;span &gt;" .$row['bank'].  "&lt;/span &gt;" . "&lt;br /&gt;" . 
                      $teller .    "&lt;span &gt;" .$row['teller_no'].  "&lt;/span &gt;" . "&lt;br /&gt;".
                      $pay .  "&lt;span &gt;" .$row['payment_date'].  "&lt;/span &gt;" . "&lt;br /&gt;";                
  
              }
  
  
              ?&gt;
              &lt;/p&gt;
  
  
      &lt;?php
  
  
  
       } else {
  
           header("location: ebcreg.php");
       }
  </code></pre>
  
  <p>I need to insert the . $ebc . $row['id'] back into the database.</p>
  
  <p>How do I do that please.
  thanks</p>