I want to insert a record into mysql with fuelphp, but I can't.
The details are as follows.
There is no error log, so as a beginner in programming, I am
I'm in a state of confusion as to what's going on.
Sorry for the inconvenience, but I would appreciate it if you could reply.
Thank you for your cooperation.
friend2.php(/Users/■■■■/Desktop/fuelphp/fuel/app/classes/controller)
Define the class in class Controller_Friend2 and
Fill in the contents to insert with the public function method and
execute(); I think the code was created to execute the contents of the method in
Please let me know if there are any defects.
<?php
namespace App\Classes;
useFriend2;
classController_Friend2 {
public function action_insert(){
DB::insert('friend') - > set(array(
'id' = > '777',
'name' = > 'Umegung Tatsuo',
'age' = > '71',
'sex' = > 'Man',
)) - > execute();
}
}
?>
localhost/friend2.php (no errors or anything)
id777,name Umemiya Tatsuo,age71,sex man not added
db.php(/Users/■■■■/Desktop/fuelphp/fuel/app/config)
<?php
return array(
'default' = > array(
'type' = > 'mysqli',
US>'connection'=>array(
'persistent' = > false,
),
'identifier' = > '`',
'table_prefix' = >',
'charset' = > 'utf8',
'collation' = > false,
'enable_cache' = > true,
'profiling' = > false,
'readonly' = > false,
),
);
db.php(/Users/■■■■/Desktop/fuelphp/fuel/app/config/development)
<?php
return array(
'default' = > array(
US>'connection'=>array(
'dsn'=>'mysql:host=localhost;dbname=personal',
'port' = > '3306',
'username' = > 'root',
'password' = > 'root',
),
'profiling' = > true,
),
);
In this code, friend2.php defines the class but does nothing.
$controller=newController_Friend2();
$controller->action_insert();
Try adding after declaring the class in the file.
© 2024 OneMinuteCode. All rights reserved.