Welcome Guest, Not a member yet? Register   Sign In
.(dot) character is not being accepted in database name
#1
Shocked 
(This post was last modified: 03-12-2020, 01:16 AM by cijagani.)

CodeIgniter 4.02 version

[font=-apple-system, BlinkMacSystemFont,]Direction
set databasename in .env file. for example[/font]



Code:
database.default.hostname = localhost
database.default.database = 'ci4.0.2'
database.default.username = root
database.default.password = root
database.default.DBDriver = MySQLi


[font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,]Created : users table[/font][/font]
PHP Code:
<?php namespace App\Database\Migrations;

use 
CodeIgniter\Database\Migration;

class 
Users extends Migration
{
public function 
up()
{
$this->forge->addField([
            'id'          => ['type' => 'INT''constraint' => 5'unsigned' => true'auto_increment' => true],
'name' => ['type' => 'VARCHAR''constraint' => 50],
'address'      => ['type' => 'VARCHAR''constraint' => 100],
'email'      => ['type' => 'VARCHAR''constraint' => 50],
            'contact'      => ['type' => 'VARCHAR''constraint' => 10],
            'created_at'  => ['type' => 'datetime''null' => true],
            'updated_at'  => ['type' => 'datetime''null' => true],
            'deleted_at'  => ['type' => 'datetime''null' => true],
        ]);

        $this->forge->addPrimaryKey('id');
        $this->forge->createTable('users'false, ['ENGINE' => 'InnoDB']);
}

//--------------------------------------------------------------------

public function down()
{
//
}



[font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,]Describe the bug[/font][/font]
Code:
E:\work\htdocs\ci4\public>php spark migrate

CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-03-12 02:36:40am

Running all new migrations...

> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`0`.`2`' at line 1
> E:\work\htdocs\ci4\public\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php - 330

[font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,]Expected behavior[/font][/font][/font][/font]
[font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,][font=-apple-system, BlinkMacSystemFont,].(dot) character should be allowed in database.default.database[/font][/font][/font][/font][/font]
  • OS: [Windows 8.1]
  • Web server [Apache 2.4.1] (wampp)
  • PHP version [7.4.3]
Reply


Messages In This Thread
.(dot) character is not being accepted in database name - by cijagani - 03-12-2020, 01:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB