Welcome Guest, Not a member yet? Register   Sign In
Default value is not available
#1

[eluser]Unknown[/eluser]
Hi,

I am using codeigniter framework and want to obtain DEFAULT value for a column in mysql database for a table.
In this regard i am using function field_data() .
I am calling a function like this :

$fields = $this->db->field_data($table);

here $table is the name of the table .

This function------field_data($table) -- in tern calls the function below

in from the directory : codeIgniter/system/database/driver/mysql/mysql_result.php

function field_data()
{
$retval = array();

while($field = mysql_fetch_field($this->result_id))
{
$F = new stdClass();
$F->name = $field->name;
$F->type = $field->type;
$F->default = $field->def;
$F->max_length = $field->max_length;
$F->primary_key = $field->primary_key;

$retval[] = $F;
}

return $retval;
}

Here i get all the attributes of a column like (column name, type ...etc) but i did not get default value.

Please help me to gid rid of this problem.

Regards
Alok
#2

[eluser]Unknown[/eluser]
[quote author="alokjha007" date="1216399751"]Hi,

I am using codeigniter framework and want to obtain DEFAULT value for a column in mysql database for a table.
In this regard i am using function field_data() .
I am calling a function like this :

$fields = $this->db->field_data($table);

here $table is the name of the table .

This function------field_data($table) -- in tern calls the function below

in from the directory : codeIgniter/system/database/driver/mysql/mysql_result.php

function field_data()
{
$retval = array();

while($field = mysql_fetch_field($this->result_id))
{
$F = new stdClass();
$F->name = $field->name;
$F->type = $field->type;
$F->default = $field->def;
$F->max_length = $field->max_length;
$F->primary_key = $field->primary_key;

$retval[] = $F;
}

return $retval;
}

Here i get all the attributes of a column like (column name, type ...etc) but i did not get default value.

Please help me to gid rid of this problem.


Please help to get the solution. An early response is highly appreciated.
Regards
Alok[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB