Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Friday, 28 August 2015

MULTIPLE DELETE IMAGES IN FOLDER ALSO IN DATABASE

Tutorial about delete multiple images in folder also in database, let's quick

Here is Controller

 public function hapus($tes_id)  
   {  
   $images= $this->db->query("SELECT * FROM `testimonial` tes_id='$tes_id'")->row_array();  
    $image=$images['tes_image'];  
   $image1=$images['testi_img1'];  
   $image2=$images['testi_img2'];  
   $image3=$images['testi_img3'];  
   $image4=$images['testi_img4'];  
   $image5=$images['testi_img5'];  
   $image6=$images['testi_img6'];  
   $image7=$images['testi_photo'];  
   $image8=$images['tes_beforeafter'];  
    $file = array($image,$image1,$image2,$image3,$image4,$image5,$image6,$image7,$image8);  
   $arrlength = count($file);  
  for($x = 0; $x < $arrlength; $x++) {  
  unlink('uploads/testimoni/' . $file[$x]);  
  }  
  $this->testimoni_model->hapus($tes_id);//  
  redirect ('admin/testimonial');   
 }  

Here is Model
 function hapus($tes_id)  
 {  
  $this->db->where('tes_id',$tes_id);  
  $this->db->delete('testimonial');  
 }   

Thanks for visiting me, hope this help your projects !

Regards !

Monday, 10 August 2015

How to save link in variable using codeignter

Hello this morning i will give short tutorial when you want to echo same href in your file.php i use codiegnter by the way, so here is my simple tutorial to make some href in echo


num_rows() < 3)
{
 echo "Tambah Data";
}
else
{
 echo "Tambah Data"; 
}
?>



Thanks for visiting me !


Saturday, 1 August 2015

REMOVE FOLDER PUBLIC IN LARAVEL

Hi this is my second post about LARAVEL just learn new things feel bored with same activity coding over and over so i try lear new thing.

For people new in laravel will feel stuck at the first time while developing projects but that's a normal every new hard, After you success download laravel in your localhost, follow my instruction

Create a folder locale inside your directory then copy all file from laravel and paste to inside folder locale



Cut all file inside public then paste out side folder locale



  1. Go to index.php came from public which has move then find this script 



and change to be like this
This explanantion caming from this url http://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url Thanks for visiting me ! if you have some question about laravel feel free to drop message or email me, cheers !

Tuesday, 28 July 2015

CI and Laravel Married

Many programmers out there talk about LA between CI, compoare both of it but ever you think laravel and codeignter will married, the looks like their child like this


 

LOL, thanks for visiting me !

Monday, 27 July 2015

Backup Database Using Codeigniter

Hi how are you ? hope fully fine.

Sometime when you developing website then it need to be back up database no matter if your client knows how to backup from cpanel but if they don't know you need to make some function on it !


Here is my href menu

  • ">Back up Database
  • by looking controller we know why it will be, then here is my controller

    template->load('template','user/user');
     }
    public function backup()
    {
      $this->load->dbutil();
      $prefs = array(     
                    'format'      => 'zip',             
                    'filename'    => 'my_db_backup.sql'
                  );
      $backup =& $this->dbutil->backup($prefs); 
      $db_name = 'backup-on-'. date("Y-m-d-H-i-s") .'.zip';
            $save = 'pathtobkfolder/'.$db_name;
      $this->load->helper('file');
            write_file($save, $backup); 
      $this->load->helper('download');
            force_download($db_name, $backup);
    }
    
    }
    
    
    

    and click then menu then system will export database in zip file inside it you get ekstensiton .sql

    Share it if this help you, Thanks for visiting me !

    Happy Coding

    Friday, 10 July 2015

    How to set height and Witdh and Height in codeignter before upload

    Hem after lunch feel boring so idecide to share what i had to share, Code ignter  yes i would share about it !

    Codeignter has configure about upload images
    Buth for me it need some add up, i have to set only images witdh 900px and height 900px allow to uploaded, many way to solved this but i prefer use php itself, check this out !



    Thanks for visiting me !




    Tuesday, 7 July 2015

    Tutorial Upload images also send to email using codeignter

    Before go to the topic, let me declare what you need to know about this !
    1. This need email to configure in your codeignter so we don't send email with pure codeignter still need another email such as gmail, etc !
    2. It just simple form upload images and one input type text if you are familiar about this  good luck !
    So let create email.php put inside application/config/email.php so here is email.php



    Then create database up tou you and don't forget to create simple table


    then here is controller
    here is my model and here is my view Just remind you about this issue, you should create folder to and i give it name folder email just to make you easy understand and you need to setting all configuration autoload in codeignter such url, form, etc to make it working ! Thanks visiting me :D

    Monday, 6 July 2015

    How to remove tag

    inside paragraph

    Hi it short tutorial for me, when you build some CMS let say only input article and upload images, and you need to customize it in front end by using css but inside table there is tag
    , what you should do if the case should make blocknote or H1 so you need to remove tag
    So here is my simple script remove tag
    Hope you understand :D