C program to get the column names of the MySQL data table in Linux
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
In this program, we will connect to the MyDb database, and then we will retrieve the column names of the "employee" table and print the result on the console screen.
Program/Source Code:
The source code to get the column names of the MySql data table in Linux is given below. The given program is compiled and executed successfully on Ubuntu 20.04.
Output:
In the above program, we included the mysql.h header file to use MySql connectivity related functions. Here, we created variables server, username, password, and database that are initialized values specific to the MySQL connectivity.
Here, we connected to the MyDb database in the MySql server using the mysql_real_connect() function and then we retrieved the name columns using mysql_fetch_row() and mysql_fetch_field() functions and then print the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer