Mysqli Get Coulmn Operation

Description

Retrives the column names from a given table

Function Reference :
mysqli_result/array dbGetColumnName(string $table_name);

Parameters

Name Type Required Parameter Info Example
table_name string Yes The name of the table to get columns. any table name like employee_table,user_table

Examples

 
          <?php 
         $sdb= new SimplifiedDB(); 
         $sdb->dbConnect("localhost","username","password","dbuser"); 
         $sdb->dbGetColumnName("user_roles"); 
         ?> 
         

Result

Returns result object by default. You can set $sdb->output_array=true, to return array as output.
If you use print_r($row) in
while ($rows = $result->fetch_array()) {
print_r($row);
}
it will show output as in following format.

Array ( [0] => roleId [Field] => roleId [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => PRI [Key] => PRI [4] => [Default] => [5] => auto_increment [Extra] => auto_increment ) Array ( [0] => role_name [Field] => role_name [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => role_description [Field] => role_description [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => )

Debuging

Debug Operation Result/Output
$sdb->query DESCRIBE user_roles
$sdb->last_insert_id
$sdb->rows_affected
$sdb->message_info Connected to database
$sdb->error_info