0

Can anyone please let me know the solution for getting the column names from empty table in MySQL using pdo php?

Bala Muruga
  • 21
  • 1
  • 5
  • No it didn't get me in a empty table? – Bala Muruga Jul 08 '20 at 12:32
  • Show what you tried please. – droopsnoot Jul 08 '20 at 12:54
  • array_keys($this->Conn->query("SELECT * FROM $table LIMIT 1")->fetch(PDO::FETCH_ASSOC)); this is what i tried @droopsnoot and my table is absolutely empty, there is no rows recorded in it, but I'm in a situation to fetch column details from that table using pdo – Bala Muruga Jul 08 '20 at 13:19
  • But if you read the first answer from the linked thread, it shows you how to use the DESCRIBE keyword to get the table description, including column names. – droopsnoot Jul 08 '20 at 13:38

0 Answers0