Topic: Codeigniter

PHP Codeigniter Insert Multiple Records Into MySQL 0

PHP Codeigniter Insert Multiple Records Into MySQL

Today, We want to share with you PHP Codeigniter Insert Multiple Records Into MySQL.In this post we will show you How to insert multiple rows in Codeigniter, hear for PHP Codeigniter Inserting Multiple Records Into a Table we will give you demo and example for implement.In this post, we will learn about Codeigniter batch insert, multiple insert in codeigniter with an example.

PHP Codeigniter Insert Multiple Records Into MySQL

There are the Following The simple About PHP Codeigniter Insert Multiple Records Into MySQL Full Information With Example and source code.

As I will cover this Post with live Working example to develop codeigniter unable to insert multiple row data to database , so the some major files and Directory structures for this example is following below.

  • Insert Multiple Records
  • using insert_batch() in CodeIgniter

Insert Multiple Records:

MySQL insert multiple rows in codeigniter Example

$membersArray = [
   [
      'name' => 'Jaydeep Gondaliya',
      'detail' => 'Angularjs developer'
   ],
   [
      'name' => 'Krunal Sisodiya',
      'detail' => 'Asp.Net developer'
   ]
];
$this->db->insert_batch('member_listTbl', $membersArray); 

Insert multiple rows with CodeIgniter

codeigniter active your record has a simple function Like insert_batch(). with INSERT multiple records without cycle in CodeIgniter

	
$devloperArray = array(
   array(
      'title' => 'Pakainfo website' ,
      'name' => 'Jaydeep Gondaliya' ,
      'date' => '25-04-1992'
   ),
   array(
      'title' => 'Infinityknow Website' ,
      'name' => 'Jaydeep Patel' ,
      'date' => '17-07-1991'
   )
);
 
$this->db->insert_batch('devloper_tbl', $devloperArray); 
 
// Produces: INSERT INTO devloper_tbl (title, name, date) VALUES ('Pakainfo website', 'Jaydeep Gondaliya', '25-04-1992'), ('Infinityknow Website', 'Jaydeep Patel', '17-07-1991')

PHP Codeigniter Insert Multiple Records Into MySQL Source code

Insert multiple rows with CodeIgniter - PHP Codeigniter Insert Multiple Records Into MySQL

Insert multiple rows with CodeIgniter

Insert multiple rows with CodeIgniter
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Codeigniter Insert Multiple Records Into MySQL.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Codeigniter MVC Tutorial Hello World 0

Codeigniter MVC Tutorial Hello World

Today, We want to share with you Codeigniter MVC Tutorial Hello World.
In this post we will show you Codeigniter Tutorial Hello World Example – Steps By Step, hear for CodeIgniter Tutorial for Beginners we will give you demo and example for implement.
In this post, we will learn about Hello world program in php codeignter, CodeIgniter mvc example with an example.

CodeIgniter is an Open Source Framework based on php,
Which can be used Easly Web Based Application.
It is Model-View-Controller (MVC) Based System and also Light Weight.
Secure and session Manegemne very easy.

Routing Easly Understand in CodeIgniter(CI) Framework.

You should have knowladge of

1) core PHP
2) MVC
3) HTML
4) CSS
5) MYSQL

Basic Environment setup

1) Xampp Server (Any Server).

Download link in Download Xampp Server

https://www.apachefriends.org/download.html //Lates version

2) Any One Editor (Notepad++).

Download link in Download Notepad++.

https://notepad-plus-plus.org/download/v6.9.2.html //Free Download Notepad++ version(Latest)

3) Download CodeIgniter Framework

Download link in Download CodeIgniter

https://codeigniter.com/download //Free Download CodeIgniter 2.x

Steps of the CodeIgniter Framework.

phase 1: Fisrt call index.php
phase 2: And then call Routing
phase 3: And then check Security
phase 4: call to Controller
phase 5: controller call to (include Model,include Libraries,include Helpers,include plugins,include Scripts)
phase 6: Fetch Data in view side in CodeIgniter
phase 7: view Caching data and index.php

Step 1:

Fisrt of all open a htdoc folder

and then inside your open config.php file

Your Application name and Application and config.php

Go to config.php change

setpup file(OLD File)
$config['base_url'] = '';

TO

New File(changes Application -> config.php)

$config['base_url'] = 'http://localhost/Your-Application-name';

Step 2:

Now
create a New Controller Name

Your Application name->application -> Controller

helloworld.php
———————


class Helloworld extends CI_Controller {

 public function __construct() { //This is a __construct initial
 parent::__construct();
 }

 public function index(){ // This is a function call in controller
 $this->load->view('helloworld_codeigniter'); 
 }
}


Step 3:

And Then a make view side->
Create a helloworld_codeigniter.php file

within save path.

application and views and helloworld_codeigniter.php.

<title>Hello World Application in CodeIgniter</title>

<div class="well">Step By step CodeIgniter Example (Hello world.! in CodeIgniter).
 
</div>

Step 4:

and then goto your application

Application_name-> config ->routes.php.

Onchange in this file -> routes.php

$route['default_controller'] = "helloworld";

Step 5 :

Last Step Now Open Your Xampp Control panel and start to mysql and apache.

run in browser : localhost/Your-Application(codeigniter)-name/helloworld

Output Your Example:

Simple Hello World! Application Using CodeIgniter

How to Get Codeigniter last inserted ID from database 0

Codeigniter last inserted ID

Today, We want to share with you Simple Way To Get Codeigniter last inserted ID.
In this post we will show you codeigniter get last insert id, hear for codeigniter get last record id we will give you demo and example for implement.In this post, we will learn about codeigniter get last insert id in controller with an example.

Codeigniter last inserted ID Example

function add_item(){
   $input = ['name'=>'Pakainfo', 'description'=>'This is Pakainfo'];

   $this->db->insert('products', $input);
   $insertId = $this->db->insert_id();

   return  $insertId;
}

As above simple example We can fetch simply codeigniter get last insert row id in controller using PHP Based “insert_id()” function, Therefor let’s simple use this Best way.

CodeIgniter last inserted ID

function saveUserInfo(){
   $input = ['name'=>'Jaydeep Gondaliya', 'email'=>'[email protected]'];
   $this->db->insert('users', $input);
   $insertId = $this->db->insert_id();
   return  $insertId;
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about how to get id from database in codeigniter.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

How to Open URL in New Tab using CodeIgniter 0

How to Open URL in New Tab using CodeIgniter

Today, We want to share with you How to Open URL in New Tab using CodeIgniter.
In this post we will show you CodeIgniter Page Redirection, hear for CodeIgniter open the url in new tab we will give you demo and example for implement.In this post, we will learn about CodeIgniter URL LINK OPEN IN NEW TAB with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

In CodeIgniter, Open new window when target=”_blank”

<Link to="/about" target="_blank">About Pakainfo.com</Link>

CodeIgniter Overview with Features

There are the Following the List of Features For CodeIgniter Pure JavaScript Latest Frameworks.

  • Zip Encoding Class
  • XML-RPC Library
  • User Agent Class
  • Unit Testing Class
  • Trackback Class
  • Template Engine Class
  • Session Management
  • Security and XSS Filtering
  • Search-engine Friendly URLs
  • Query Builder Database
  • Pagination
  • Model-View-Controller Based System
  • Localization
  • Full Page Caching
  • Form and Data Validation
  • Flexible URI Routing
  • File Uploading Class
  • FTP Class
  • Extremely Light Weight
  • Error Logging
  • Data Encryption
  • Calendaring Class
  • Benchmarking
  • Application Profiling

CodeIgniter redirect to a new tab

$this->load->helper('url');

echo anchor('https://pakainfo.com/whatever', 'title="Pakainfo Jaydeep"', array('target' => '_blank', 'class' => 'new_window'));

CodeIgniter Redirects

$this->load->helper('url');

//second way

$this->load->helper('url');

if (!$user_logged_in)
{
  redirect('/account/login', 'refresh');
}

CodeIgniter Redirect To External Domains

CodeIgniter URL Routing Simple External Domains Redirects Example

<IfModule mod_rewrite.c>
     
    RewriteEngine On
    RewriteBase /
 
    # Disable pakainfo.com rewrite for some valid directory/files     
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d 
 
    #map all pakainfo.com request urls to a good more controller method
    RewriteRule ^(.*)$ index.php?/{controller}/{method}/$1 [L]
</IfModule>

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about CodeIgniter URL LINK OPEN IN NEW TAB.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.