Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
db name
  • hi
    get current database name (current environment);
    get list of columns for full information like `comment`:  \DB::query("SHOW FULL COLUMNS FROM ".$table)->as_object()->execute();

  • What exactly is the question?
  • 1- i need get current database name in active environment;
    2- how can get this query result : SHOW FULL COLUMNS FROM table_name
  • HarroHarro
    Accepted Answer
    1. It's not readily available, you need to retrieve it from the DB config.

    And you might need to parse it, since different types use different fields. For example "mysqli" uses a "database" field, but PDO uses a "dsn" that contains the database name.

    2. Try \Database::instance()->list_columns($table);

    It returns an array with all information about every table column, including comments if present.

    A Database instance also holds it's own config, but it is not exposed so you can't get to it. If you want to take that route, you need to overload the class and add a method to access the _config property.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion