Iam using this code to display all the column fields from database table and it works fine.

Please how do I avoid displaying column named id which is the first column in the table

<?php
require('db.php');
$result = $db->prepare('SHOW COLUMNS from info4');

$result->execute(array());
while ($row = $result->fetch()) 
{

echo $rw = $row[0];
}
?>

1 Answers

0
aidinMC On Best Solutions

You can display columns one by one!

$data = $result->fetchall();
foreach($data as $row){
   echo $row['col1'];
   echo $row['col2'];
}