Posts

Showing posts with the label PHP

Install Xampp Server on Ubuntu OS

https://linuxconfig.org/how-to-install-xampp-on-ubuntu-linux

PHP Data Objetcts (PDO)

Image
PDO Tutorial

Xampp Customization

Image
Change Target Project Directory from httpd.conf File Path: C:\xampp\apache\conf\httpd.conf Change Target Project Directory from httpd.conf File Path: C:\xampp\php\php.ini post_max_size, upload_max_filesize, max_exexution_time, max_input_time, memory_limit, max_allowed_packet

MySql Joins Fetch Data

Image

Complete Class to Insert Data and Upload Image in PHP OOPS

<?php require('config.php'); class kaamdhenu extends config{              private $preparequery, $executequery;          public function setter(){              $this->executequery = mysqli_query($this->conn,$this->preparequery);              }          function registeruser(){         $this->preparequery = "INSERT INTO kaamdhenu_users(firstName,lastName,password,email,phone,gender,sec_question,sec_answer) VALUES ('".$_POST['fname']."', '".$_POST['lname']."','".$_POST['password']."',         '".$_POST['email']."','".$_POST['phone']."','".$_POST['gender']."','".$_POST['squestion']."','".$_POST['sAnswer']."')";$this->setter();                  if($this->executequery){             echo "Successfully Regis...

Image Upload PHP Core or OOPs

'jobseeker_photo' is the name  of the input  $file = $FILES['jobseeker_photo'];                  $fileName = $_FILES['jobseeker_photo']['name'];         $fileTmpName = $_FILES['jobseeker_photo']['tmp_name'];         $fileSize = $_FILES['jobseeker_photo']['size'];         $fileError = $_FILES['jobseeker_photo']['error'];         $fileType = $_FILES['jobseeker_photo']['type'];                  $fileExt = explode('.', $fileName);         $fileActualExt = strtolower(end($fileExt));                  $allowed = array('jpg', 'jpeg', 'png');                         if(in_array($fileActualExt, $allowed)) {             if($fileError === 0){       ...

Dynamic On Page Navigation

Dynamic On-page Navigation to load Previous and Next Pages <div class="container" id="art_animation">   <div class="row">     <div class="col">        <hgroup><h2>{{$blog->title}}</h2>         <span>By           <a href="#">             {{getUserData($user_id,'name')}}           </a>                </span>                  <span>In<a href="#">Blog</a></span><span class="text-secondary">{{date("l, F d, Y",strtotime($blog->created_at))}}</span></hgroup>        <p>{{strip_tags($blog->body)}}</p>     </div>   </div>   <hr>   <div id="navigate_pages">      <div id="box...

Event Calendar

Event Calendar HTML, CSS and JS

Constructor & Destructor in PHP OOPS

Image

Testimonial Slider

HTML    <!--   #### EDIT   I built this slider when I first started to learn JS, you can rebuild it with more readable, simple and less code, I'm too lazy to update it, sorry :)   -->   <!--     -->  <!-- <section id="testim" class="testim">           <div class="testim-cover">                <div class="wrap">                   <span id="right-arrow" class="arrow right fa fa-chevron-right"></span>                   <span id="left-arrow" class="arrow left fa fa-chevron-left "></span>                   <ul id="testim-dots" class="dots">                       <li class="dot active"></li>         ...

Dynamic Bootstrap Carousel Slider

<!-- <?php  // $slides = App\Slider::select('*')->get(); ?>--> <!--------------------Carousel Slider------------------------->  <!--<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel">   <div class="carousel-inner">     @foreach ($slides as $i => $slide)     <div class="carousel-item @if($loop->first) active @endif" data-interval="2000">       <img src="{{asset('upload/slides/'.$slide->image_name)}}.jpg" class="d-block w-100" alt="...">     </div>     @endforeach       </div>   <a class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev">     <span class="carousel-control-prev-icon" aria-hidden="true"></span>     <span class="sr-only">Previous</span>   ...

Methods Laravel

1. To use Dynamic Slug  Route::get('{slug}', 'IndexController@blog_details'); Route::get('{slug}', 'IndexController@news_details'); Link: {{ URL::to(''.$new->slug )}} 1. Fetch first/last entry in the table $video_news = App\News::oldest()->first(); $video_news = App\News::latest()->first();

Functions Built-in PHP

1.  strip_tags() Function The Data from Text Editor- SAVED WITH TAGS - into Database Table To display data on page without tags -  strip_tags() Function  is used Ex: {{strip_tags($blog->body)}} 2.  date() Function To Display Date from Database Table in desired Format {{date("l, F d, Y",strtotime($post->created_at))}} 2. substr () Function To Display String setting WORD LIMIT from Database Table in desired Format {{substr(strip_tags($post->body), 0, 150)}}

Display Latest N Number of Entries from Database Table

$dogs = Dogs :: orderBy ( 'id' , 'desc' )-> take ( 5 )-> get ();

Text Editor

Text Editor                <div class="form-group">                    <label for="title" class="col-sm-3 control-label">Event Details</label>                    <div class="col-sm-9">                        <textarea id="details" name="details" class="summernote">{{isset($event->details)?$event->details:null}}</textarea>                    </div>                </div> <script type="text/javascript">     $('.summernote').summernote({       airMode: true       }); </script> The Data from this Text Editor- SAVED WITH TAGS - into Database Table To display data on page without tags - strip_tags() Funct...

Upload Images

Upload Single Image if($request->file('reg_photo')){                                     // Uploading Registration photo                 $tmpFilePath = public_path('/assets/images/reg-photo/');                 // echo $tmpFilePath; die();                 $p_hadPath ='reg-photo_'.time();                 $img = Image::make($request->file('reg_photo'));                 $img->save($tmpFilePath.$p_hadPath.'.jpg');                 $reg_photo = $p_hadPath.'.jpg';             } Upload Multiple Images         $arr_degree_photo = [];         $degree_photo = $request->file('degree_photo'...

Image Preview Scripts & Add Multiple Boxes Scripts

How to load Single Image Preview <input type="file" name="" id="" onchange="readURL(this, previewImage)"> <img id="previewImage" value="">  <script type="text/javascript">         function readURL(This, img_id) {         var reader = new FileReader();         reader.onload = function(e) {         $('img#'+img_id).attr('src', e.target.result);         $('img#'+img_id).addClass('on__changeImg');         $('img#'+img_id).css('border','1px solid #000');         }         reader.readAsDataURL(This.files[0]);         }   </script> How to load Single Image Preview <script> function readURL(input) {     if (input.files && input.files[0]) {         var reader = new FileReader();         reader.onload = function (e) { ...