Tag

Codeigniter

Browsing

Codeigniter 3 CRUD Operation with MySQL Database with example In this tutorial, I will cover CRUD operation with MySQL database with example in Codeigniter 3. You can check the step by step process we used a simple application having crud functionality in Codeigniter 3 with MySQL Database. CRUD operation is functionality in all application of familiarity with basic create, read, update and delete functionality with the Database. The Process of crud functionality. Step 1: Install…

1) Configure database connection Application/config/database.php Hostname, Username, Password, Database name $db[‘default’] = array( ‘dsn’ => ”, ‘hostname’ => ‘localhost’, ‘username’ => ‘root’, ‘password’ => ‘root’, ‘database’ => ‘code3’, ‘dbdriver’ => ‘mysqli’, ‘dbprefix’ => ”, ‘pconnect’ => FALSE, ‘db_debug’ => (ENVIRONMENT !== ‘production’), ‘cache_on’ => FALSE, ‘cachedir’ => ”, ‘char_set’ => ‘utf8’, ‘dbcollat’ => ‘utf8_general_ci’, ‘swap_pre’ => ”, ‘encrypt’ => FALSE, ‘compress’ => FALSE, ‘stricton’ => FALSE, ‘failover’ => array(), ‘save_queries’ => TRUE ); 2) Create…

RewriteEngine on RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} (sale|success|cancel) [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !(static|sale|success|cancel) [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond $1 !^(index\.php|resources|robots\.txt|static) [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] ### Force HTTPS RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^www.websiteurl.com [NC] RewriteRule ^(.*)$ http://websiteurl.com/$1 [L,R=301]

Steps to remove index.php from URL 1. Change the index_page configuration like $config[‘index_page’] = ‘’; 2. Create .htaccess file and add the following code RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] After the configuration

change your application->config->config.php and set $config[‘sess_driver’] = ‘database’; $config[‘sess_cookie_name’] = ‘ci_session’; $config[‘sess_expiration’] = 7200; $config[‘sess_save_path’] = ‘ci_sessions’; $config[‘sess_match_ip’] = FALSE; $config[‘sess_time_to_update’] = 300; $config[‘sess_regenerate_destroy’] = FALSE; & Run SQL query CREATE TABLE IF NOT EXISTS `ci_sessions` ( `id` varchar(40) NOT NULL, `ip_address` varchar(45) NOT NULL, `timestamp` int(10) unsigned DEFAULT 0 NOT NULL, `data` blob NOT NULL, PRIMARY KEY (id), KEY `ci_sessions_timestamp` (`timestamp`) );

if you allow true in $config[‘csrf_protection’] = true; within config file and you are also add autoload form than we can use. Step 1. within config folder autoload file upload form helper $autoload[‘helper’] = array(‘url’, ‘file’,’form’); Step 2. $config[‘csrf_protection’] = true; Step 3. while uploading in view folder <?php echo form_open_multipart(‘admin/file_upload’); ?> Otherwise, you can use only $config[‘csrf_protection’] = false;

Faster PHP Cloud Hosting