Posts

Upload multiple images in Codeigniter

First of all, you must create a table images in your database Follow  the following code in your controllers $this -> load -> library ( 'upload' );      foreach ($_FILES[ 'picture' ][ 'name' ] as $key => $value) {       $secure_id = get_secure_id ($id) . rand ( 1 , 100 );       $_FILES[ 'picture_' . $key][ 'name' ] = $_FILES[ 'picture' ][ 'name' ][$key];       $_FILES[ 'picture_' . $key][ 'type' ] = $_FILES[ 'picture' ][ 'type' ][$key];       $_FILES[ 'picture_' . $key][ 'tmp_name' ] = $_FILES[ 'picture' ][ 'tmp_name' ][$key];       $_FILES[ 'picture_' . $key][ 'error' ] = $_FILES[ 'picture' ][ 'error' ][$key];       $_FILES[ 'picture_' . $key][ 'size' ] = $_FILES[ 'picture' ][ 'size' ][$key];   if ( ! empty ($_FILES[ 'picture' ][ 'tmp_name' ][$k

How to load 2 databases in one single coding using Codeigniter?

Go to application/config/database.php . Create another database config like default database. //Default database configuration $db [ 'default' ] = array(      'dsn'        =>  '' ,      'hostname'  =>  'localhost' ,      'username'  =>  'db_username' ,      'password'  =>  'db_password' ,      'database'  =>  'db_name' ,      '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'  =>  FA

How to generate token by using uniqid?

For this section, i used token to save into cookie to do remember me function. But, this column will be focusing on how to generate token or mix number by using uniqid. 1)  If you want to test the uniqid(), you can include this coding and see the output : <?php echo uniqid(); ?> 2) In my system, i generate uniqid() and the uniqid is include with the user_id. The coding is shown below : $login_token = uniqid () . $this -> session -> user_id; So, you can see the output when you test in your system.

How to live your system?

Image
This section will explain on how to live your system into the server. There are a few steps that must be follow. 1) Open your FileZilla and create a new site. Insert your host name and your username. After that, make a connection into the server. 2) Now, upload your localhost coding folder into server. 3) After finish upload into your server, run the system in your browser. At this phase, you will see database error. Now, we will configure the database. 4) Open your CPanel and click MySQL Database to setup database in your server. Create your database. 5) After create your database, now go to the next step which is create user for your database. 6) Then, add your user into your database. It will ask for privillege. So, choose yours or you can tick all. 7) Now, your server database has been created. Next step is, we want to export the local database into server database. Open your MySQL in your PC. 8) Create a new connection and setup your database. Insert the n

How to insert google map in HTML?

Image
For this section, I used HTML iframe to embed google map into my website. There are easy way to make it done. 1) Firstly, you must insert map-responsive class into your <div>. After that, insert <ifrane> and put the location from the google map and it done.   < div class = "container-fluid" > < div class = "map-responsive" > < iframe src = "https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d15934. 114728328961!2d101.73806!3d3.217592!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0xc6 079a4b5e56c0d!2sKoperasi+Peserta-Peserta+Felcra+Malaysia+Berhad(KPFMB)!5e0!3m2!1sen !2sus!4v1552549089831" width = "300" height = "200" frameborder = "0" style = " border:0" allowfullscreen ></ iframe > </ div > 2) The ouput :

How to use Datepicker

Image
There are a few steps for us to implement datepicker into our form. Firstly, you must know which version of bootstrap used. For this tutorial, I used bootstrap 4. Therefore, it is not suitable for other bootstrap. Copy the script below into your form and put in at the bottom of your coding section <!-- Date Picker --> < script src = "https://code.jquery.com/jquery-3.3.1.min.js" ></ script > < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css /bootstrap.min.css" integrity = "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlS AwiGgFAW/dAiS6JXm" crossorigin = "anonymous" > < script src = "https://unpkg.com/gijgo@1.9.11/js/gijgo.min.js" type = "text/\ javascript" ></ script > < link href = "https://unpkg.com/gijgo@1.9.11/css/gijgo.min.css" rel = "stylesheet" type = "text/css" /&g