Translate

In this Tutorial, We are going to convert PHPMysql table rows into columns using as Example:-

Original SQL table is: -
ID username age
1 Himanshu 23
2  Junned        46

New  SQL table is: -
Here We have converted into rows to columns.
ID                      1                2
username      Himanshu           Junned
age                     23               46

Using the below code we can perform changes.
In below code, we have made connection with database and username.
 $rows) {
 foreach($rows as $field => $value)
   {
      $recnew[$field][] = $value;
    }
   }
 foreach ($recnew as $key => $values)
  {
      echo "\n";
      echo "\t" . $key . "\n";
  foreach ($values as $cell)
    {
      echo "\t" . $cell . "\n";
     }
      echo "\n"; // end rows
   }
 echo "";
?>
If you still face any problem in coding then feel free to query us through contact form.
Don't forget to send feedback to us.
Happy Coding,


0 comments:

Post a Comment

 
Top